File tree Expand file tree Collapse file tree 10 files changed +55
-101
lines changed Expand file tree Collapse file tree 10 files changed +55
-101
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,11 @@ jobs:
4040 uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
4141 with :
4242 go-version-file : ' go.mod'
43- - name : Install golangci-lint
44- uses : golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
45- with :
46- version : v1.64.8
43+ # TODO turn on lint
44+ # - name: Install golangci-lint
45+ # uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
46+ # with:
47+ # version: v1.64.8
4748
4849 # TODO: Pull this next one out once there's a helm-release for rancher 2.9
4950 - name : Checkout rancher/rancher and build the chart
6162 env :
6263 K3D_VERSION : latest
6364
64- - name : ci
65- run : make ci
65+ - name : Run unit tests
66+ run : go test --coverpkg=./pkg/... -coverprofile=coverage.out --count=1 ./pkg/...
67+
68+ # TODO allow lint to run
69+ # - name: Run validation
70+ # run: golangci-lint run
71+
72+ - name : Build
73+ run : make build
74+
75+ - name : Package
76+ run : make package
6677
6778 - name : setup cluster
6879 run : ./.github/workflows/scripts/setup-cluster.sh
Original file line number Diff line number Diff line change 44cd $( dirname $0 ) /../../..
55DIST_DIR=" $PWD " /dist
66
7+ # Build the integration test binary
8+ go test ./tests/integration/... -c -o ./bin/rancher-webhook-integration.test
9+
710source ./scripts/version
811# Source tags file to get the last built tags
912source ./dist/tags
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- TARGETS := $( shell ls scripts)
1+ .PHONY : all build test validate package package-helm clean
22
3- .dapper :
4- @echo Downloading dapper
5- @curl -sL https://releases.rancher.com/dapper/latest/dapper-$$(uname -s ) -$$(uname -m ) > .dapper.tmp
6- @@chmod +x .dapper.tmp
7- @./.dapper.tmp -v
8- @mv .dapper.tmp .dapper
3+ all : build
94
10- $( TARGETS ) : .dapper
11- ./.dapper $@
5+ build :
6+ ./scripts/build
127
13- clean :
14- rm -rf build bin dist
8+ test :
9+ ./scripts/test
10+
11+ validate :
12+ ./scripts/validate
1513
16- .DEFAULT_GOAL := default
14+ package-helm :
15+ ./scripts/package-helm
1716
18- .PHONY : $(TARGETS )
17+ package : build package-helm
18+ ./scripts/package
19+
20+ clean :
21+ rm -rf bin dist
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ source $(dirname $0)/version
55
66cd $( dirname $0 ) /..
77
8+ go mod vendor
9+
810mkdir -p bin
911if [ " $( uname) " = " Linux" ]; then
1012 OTHER_LINKFLAGS=" -extldflags -static -s"
Original file line number Diff line number Diff line change @@ -9,4 +9,4 @@ cd $(dirname $0)
99./validate-ci
1010./package
1111./package-helm
12- ./test-helm
12+ ./test-helm
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#! /bin/bash
2- set -eu
2+ set -e
33
44source $( dirname $0 ) /version
55
6- cd $( dirname $0 ) /..
7-
8- echo Running package
9-
10- mkdir -p dist/artifacts
11- cp bin/webhook dist/artifacts/webhook-linux${SUFFIX}
12- for i in bin/webhook-* ; do
13- if [ -e " $i " ]; then
14- cp $i dist/artifacts
15- fi
16- done
17- REPO=rancher
18-
19- IMAGE=${REPO} /webhook:${TAG}
20- DOCKERFILE=./package/Dockerfile
21- if [ -e ${DOCKERFILE} .${ARCH} ]; then
22- DOCKERFILE=${DOCKERFILE} .${ARCH}
23- fi
24-
25- if [[ ${USE_DOCKER_BUILDX:- 0} -eq 1 ]]; then
26- docker buildx build --platform linux/amd64 -f ${DOCKERFILE} . -t ${IMAGE}
27- else
28- docker build -f ${DOCKERFILE} -t ${IMAGE} .
29- fi
30- echo Built ${IMAGE}
31-
32- docker save -o dist/rancher-webhook-image.tar ${IMAGE}
33- echo IMAGE_TAG=" ${TAG} " > dist/image_tag
34-
35- if [ " ${PUSH:- } " = " true" ]; then
36- docker push ${IMAGE}
37- fi
6+ echo " --- Building and packaging final image ---"
7+
8+ docker build \
9+ -f package/Dockerfile \
10+ --build-arg ARCH=${ARCH} \
11+ --build-arg VERSION=${HELM_CHART_VERSION} \
12+ --build-arg COMMIT=${COMMIT} \
13+ -t rancher/webhook:${TAG} \
14+ .
15+
16+ echo " --- Saving image to tarball ---"
17+ mkdir -p dist
18+ chmod a+rwx dist
19+ docker save -o dist/rancher-webhook-image.tar rancher/webhook:${TAG}
20+ echo IMAGE_TAG=${TAG} > dist/image_tag
You can’t perform that action at this time.
0 commit comments