Skip to content

Commit fbe9d11

Browse files
committed
Removing dapper from the build process
1 parent 1eb8e54 commit fbe9d11

File tree

10 files changed

+55
-101
lines changed

10 files changed

+55
-101
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff 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
@@ -61,8 +62,18 @@ jobs:
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

.github/workflows/scripts/integration-test-ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ set -eu
44
cd $(dirname $0)/../../..
55
DIST_DIR="$PWD"/dist
66

7+
# Build the integration test binary
8+
go test ./tests/integration/... -c -o ./bin/rancher-webhook-integration.test
9+
710
source ./scripts/version
811
# Source tags file to get the last built tags
912
source ./dist/tags

Dockerfile

Whitespace-only changes.

Dockerfile.dapper

Lines changed: 0 additions & 29 deletions
This file was deleted.

Makefile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
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

scripts/build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ source $(dirname $0)/version
55

66
cd $(dirname $0)/..
77

8+
go mod vendor
9+
810
mkdir -p bin
911
if [ "$(uname)" = "Linux" ]; then
1012
OTHER_LINKFLAGS="-extldflags -static -s"

scripts/ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ cd $(dirname $0)
99
./validate-ci
1010
./package
1111
./package-helm
12-
./test-helm
12+
./test-helm

scripts/default

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/entry

Lines changed: 0 additions & 11 deletions
This file was deleted.

scripts/package

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
#!/bin/bash
2-
set -eu
2+
set -e
33

44
source $(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

0 commit comments

Comments
 (0)