Skip to content

Commit 63dfc78

Browse files
authored
fix: remove vendor dependency in virtualized toolchain (argoproj#8000)
Signed-off-by: Jesse Suen <[email protected]>
1 parent 487db97 commit 63dfc78

11 files changed

+20
-40
lines changed

hack/generate-proto.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ APIMACHINERY_PKGS=(
3838
export GO111MODULE=on
3939
[ -e ./v2 ] || ln -s . v2
4040

41-
${PROJECT_ROOT}/dist/go-to-protobuf \
41+
go-to-protobuf \
4242
--go-header-file=${PROJECT_ROOT}/hack/custom-boilerplate.go.txt \
4343
--packages=$(IFS=, ; echo "${PACKAGES[*]}") \
4444
--apimachinery-packages=$(IFS=, ; echo "${APIMACHINERY_PKGS[*]}") \

hack/installers/checksums/jq-1.6-linux-amd64.sha256

-1
This file was deleted.

hack/installers/checksums/jq_1.6-1_arm64.deb.sha256

-1
This file was deleted.

hack/installers/checksums/jq_1.6-1_armhf.deb.sha256

-1
This file was deleted.

hack/installers/install-codegen-go-tools.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ SRCROOT="$( CDPATH='' cd -- "$(dirname "$0")/../.." && pwd -P )"
99
# unecessary dependencies to go.mod). We want to maintain a single source of truth for versioning
1010
# our binaries (either go.mod or go install <pkg>@<version>), so we use two techniques to install
1111
# our CLIs:
12-
# 1. For CLIs which are NOT vendored in go.mod, we can run `go install` with an explicit version
13-
# 2. For packages which we *do* vendor in go.mod, we can run `go install` from the vendor directory
12+
# 1. For CLIs which are NOT vendored in go.mod, we can run `go install <pkg>@<version>` with an explicit version
13+
# 2. For packages which we *do* vendor in go.mod, we determine version from go.mod followed by `go install` with that version
1414
go_mod_install() {
15-
go install -mod=vendor ./vendor/$1
15+
module=$(go list -f '{{.Module}}' $1 | awk '{print $1}')
16+
module_version=$(go list -m $module | awk '{print $NF}' | head -1)
17+
go install $1@$module_version
1618
}
1719

1820
# All binaries are compiled into the argo-cd/dist directory, which is added to the PATH during codegen
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22
set -eux -o pipefail
33

4-
KUSTOMIZE_VERSION=4.2.0 "$(dirname $0)/../install.sh" helm2-linux jq-linux kustomize-linux protoc-linux
4+
KUSTOMIZE_VERSION=4.2.0 "$(dirname $0)/../install.sh" helm2-linux kustomize-linux protoc-linux

hack/installers/install-jq-linux.sh

-28
This file was deleted.

hack/tool-versions.sh

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
awscliv2_version=2.4.6
1212
helm2_version=2.17.0
1313
helm3_version=3.7.1
14-
jq_version=1.6
1514
ksonnet_version=0.13.1
1615
kubectl_version=1.17.8
1716
kubectx_version=0.6.3

hack/update-codegen.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@ set -o nounset
2020
set -o pipefail
2121

2222
PROJECT_ROOT=$(cd $(dirname ${BASH_SOURCE})/..; pwd)
23+
PATH="${PROJECT_ROOT}/dist:${PATH}"
2324

2425
TARGET_SCRIPT=/tmp/generate-groups.sh
26+
27+
# codegen utilities are installed outside of generate-groups.sh so remove the `go install` step in the script.
2528
sed -e '/go install/d' ${PROJECT_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh > ${TARGET_SCRIPT}
2629

30+
# generate-groups.sh assumes codegen utilities are installed to GOBIN, but we just ensure the CLIs
31+
# are in the path and invoke them without assumption of their location
32+
sed -i.bak -e 's#${gobin}/##g' ${TARGET_SCRIPT}
33+
2734
[ -e ./v2 ] || ln -s . v2
28-
GOBIN=${PROJECT_ROOT}/dist bash -x ${TARGET_SCRIPT} "deepcopy,client,informer,lister" \
35+
bash -x ${TARGET_SCRIPT} "deepcopy,client,informer,lister" \
2936
github.com/argoproj/argo-cd/v2/pkg/client github.com/argoproj/argo-cd/v2/pkg/apis \
3037
"application:v1alpha1" \
3138
--go-header-file ${PROJECT_ROOT}/hack/custom-boilerplate.go.txt

hack/update-openapi.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PATH="${PROJECT_ROOT}/dist:${PATH}"
1010
VERSION="v1alpha1"
1111

1212
[ -e ./v2 ] || ln -s . v2
13-
./dist/openapi-gen \
13+
openapi-gen \
1414
--go-header-file ${PROJECT_ROOT}/hack/custom-boilerplate.go.txt \
1515
--input-dirs github.com/argoproj/argo-cd/v2/pkg/apis/application/${VERSION} \
1616
--output-package github.com/argoproj/argo-cd/v2/pkg/apis/application/${VERSION} \

test/container/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN apt-get update && apt-get install --fix-missing -y \
1818
git \
1919
git-lfs \
2020
gpg \
21+
jq \
2122
make \
2223
wget \
2324
gcc \
@@ -29,14 +30,16 @@ RUN apt-get update && apt-get install --fix-missing -y \
2930

3031
COPY --from=golang /usr/local/go /usr/local/go
3132

32-
ENV PATH /go/bin:/usr/local/go/bin:$PATH
33+
ENV PATH /dist:/go/bin:/usr/local/go/bin:$PATH
3334
ENV GOROOT /usr/local/go
3435
ENV GOPATH /go
3536

3637
# Install build and test dependencies
3738
ADD ./hack/tool-versions.sh .
3839
ADD ./hack/install.sh .
3940
ADD ./hack/installers installers
41+
ADD go.mod go.mod
42+
ADD go.sum go.sum
4043

4144
RUN ./install.sh ksonnet-linux && \
4245
./install.sh helm2-linux && \

0 commit comments

Comments
 (0)