8000 Switch to go mod by gpaul · Pull Request #2327 · argoproj/argo-cd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Switch to go mod #2327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ commands:
git config --global user.name "Your Name"
echo "export PATH=/home/circleci/.go_workspace/src/github.com/argoproj/argo-cd/hack:\$PATH" | tee -a $BASH_ENV
echo "export GIT_ASKPASS=git-ask-pass.sh" | tee -a $BASH_ENV
dep_ensure:
mod_vendor:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure it is a good idea to use mod vendor in ci, it makes it different than the actual release. And it is ignored unless we pass it in go build and go test with -mod=vendor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I prefer checking in ./vendor to my repos, but the status quo in argo-cd is to download dependencies in CI (it used to use dep ensure, so I switched to using go mod -vendor.)

However, IIRC this doesn't quite work, as mod vendor doesn't download the entire dependency, only the transitively depended upon go code in the dependencies. This means that *.proto files, for example, aren't included in the download.

golang/go#26366

This means go mod -vendor and dep ensure behave differently. The vend tool (https://github.com/nomad-software/vend) should be able to help.

steps:
- restore_cache:
keys:
- vendor-v4-{{ checksum "Gopkg.lock" }}
- vendor-v4-{{ checksum "go.mod" }}
- run:
name: Run dep ensure
command: dep ensure -v
name: Run go mod vendor
command: GO111MODULE=on go mod vendor
- save_cache:
key: vendor-v4-{{ checksum "Gopkg.lock" }}
key: vendor-v4-{{ checksum "go.mod" }}
paths:
- vendor
install_golang:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
keys: [codegen-v2]
- run: ./hack/install.sh codegen-go-tools
- run: sudo ./hack/install.sh codegen-tools
- run: dep ensure
- run: GO111MODULE=on go mod vendor
- save_cache:
key: codegen-v2
paths: [vendor, /tmp/dl, /go/pkg]
Expand All @@ -73,7 +73,7 @@ jobs:
# We exclude the Swagger resources; CircleCI doesn't generate them correctly.
# When this fails, it will, create a patch file you can apply locally to fix it.
# To troubleshoot builds: https://argoproj.github.io/argo-cd/developer-guide/ci/
git diff --exit-code -- . ':!Gopkg.lock' ':!assets/swagger.json' | tee codegen.patch
git diff --exit-code -- . ':!go.sum' ':!assets/swagger.json' | tee codegen.patch
- store_artifacts:
path: codegen.patch
destination: .
Expand All @@ -87,13 +87,13 @@ jobs:
- checkout
- restore_cache:
key: test-dl-v1
- run: sudo ./hack/install.sh kubectl-linux kubectx-linux dep-linux ksonnet-linux helm-linux kustomize-linux
- run: sudo ./hack/install.sh kubectl-linux kubectx-linux ksonnet-linux helm-linux kustomize-linux
- save_cache:
key: test-dl-v1
paths: [/tmp/dl]
- configure_git
- run: go get github.com/jstemmer/go-junit-report
- dep_ensure
- mod_vendor
- save_go_cache
- run: make test
- run:
Expand Down Expand Up @@ -128,12 +128,12 @@ jobs:
- checkout
- restore_cache:
keys: [e2e-dl-v1]
- run: sudo ./hack/install.sh kubectx-linux dep-linux ksonnet-linux helm-linux kustomize-linux
- run: sudo ./hack/install.sh kubectx-linux ksonnet-linux helm-linux kustomize-linux
- run: go get github.com/jstemmer/go-junit-report
- save_cache:
key: e2e-dl-v10
paths: [/tmp/dl]
- dep_ensure
- mod_vendor
- configure_git
- run: make cli
- run:
Expand Down Expand Up @@ -212,4 +212,4 @@ workflows:
- ui:
requires:
- codegen
- e2e
- e2e
15 changes: 2 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ WORKDIR /tmp
ADD hack/install.sh .
ADD hack/installers installers

RUN ./install.sh dep-linux
RUN ./install.sh packr-linux
RUN ./install.sh kubectl-linux
RUN ./install.sh ksonnet-linux
Expand Down Expand Up @@ -98,23 +97,13 @@ RUN NODE_ENV='production' yarn build
####################################################################################################
FROM golang:1.12.6 as argocd-build

COPY --from=builder /usr/local/bin/dep /usr/local/bin/dep
COPY --from=builder /usr/local/bin/packr /usr/local/bin/packr

# A dummy directory is created under $GOPATH/src/dummy so we are able to use dep
# to install all the packages of our dep lock file
COPY Gopkg.toml ${GOPATH}/src/dummy/Gopkg.toml
COPY Gopkg.lock ${GOPATH}/src/dummy/Gopkg.lock

RUN cd ${GOPATH}/src/dummy && \
dep ensure -vendor-only && \
mv vendor/* ${GOPATH}/src/ && \
rmdir vendor

# Perform the build
WORKDIR /go/src/github.com/argoproj/argo-cd
COPY . .
RUN make cli server controller repo-server argocd-util && \
RUN GO111MODULE=on go mod vendor && \
make cli server controller repo-server argocd-util && \
make CLI_NAME=argocd-darwin-amd64 GOOS=darwin cli


Expand Down
Loading
0