Skip to content

Commit 11e300f

Browse files
committed
chore: run e2e using go test
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
1 parent 6d0c1e2 commit 11e300f

2 files changed

Lines changed: 34 additions & 21 deletions

File tree

‎Taskfile.yml‎

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,16 @@ tasks:
153153
DAGGER_GOLANGCI_LINT_SHA: ff27cd50f6b4eed2e3753c520632cd6099e1ce52
154154
# renovate: datasource=docker depName=golangci/golangci-lint versioning=docker
155155
GOLANGCI_LINT_VERSION: v2.13.2
156+
# renovate: datasource=docker depName=golang versioning=docker
157+
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
156158
internal: true
157159
cmds:
158160
- >
159-
GITHUB_REF= dagger -sc "github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA}
160-
--version ${GOLANGCI_LINT_VERSION} |
161+
echo $(pwd);
162+
GITHUB_REF= dagger -c "github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA}
163+
--version ${GOLANGCI_LINT_VERSION}
164+
--go-version ${GOLANG_IMAGE_VERSION} |
161165
run . --config .golangci.yml | stdout"
162-
sources:
163-
- ./**/*.go
164166
165167
internal:wordlist-ordered:
166168
desc: Order the word list file
@@ -225,11 +227,13 @@ tasks:
225227
K8S_VERSION: 1.31.0
226228
# renovate: datasource=git-refs depName=controller-runtime packageName=https://github.com/kubernetes-sigs/controller-runtime versioning=semver
227229
SETUP_ENVTEST_VERSION: 0.24.1
230+
# renovate: datasource=docker depName=golang versioning=docker
231+
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
228232
internal: true
229233
cmds:
230234
- >
231235
GITHUB_REF= dagger -s call -m ./dagger/gotest
232-
--go-version {{.GO_VERSION}}
236+
--go-version ${GOLANG_IMAGE_VERSION}
233237
--kube-version ${K8S_VERSION}
234238
--setup-envtest-version ${SETUP_ENVTEST_VERSION}
235239
unit-test --src .
@@ -311,9 +315,14 @@ tasks:
311315
internal: true
312316
deps:
313317
- internal:registry-network-connect
318+
env:
319+
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
320+
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
321+
# renovate: datasource=docker depName=golang versioning=docker
322+
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
314323
cmds:
315324
- >
316-
dagger run docker buildx build -f containers/Dockerfile.plugin --build-arg GO_VERSION={{.GO_VERSION}}
325+
dagger run docker buildx build -f containers/Dockerfile.plugin --build-arg GO_VERSION=${GOLANG_IMAGE_VERSION}
317326
--tag localhost:{{.REGISTRY_PORT}}/plugin-barman-cloud:testing --push .
318327
319328
# We build an image and push it to a local registry.
@@ -323,9 +332,14 @@ tasks:
323332
internal: true
324333
deps:
325334
- internal:registry-network-connect
335+
env:
336+
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
337+
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
338+
# renovate: datasource=docker depName=golang versioning=docker
339+
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
326340
cmds:
327341
- >
328-
dagger run docker buildx build -f containers/Dockerfile.sidecar --build-arg GO_VERSION={{.GO_VERSION}}
342+
dagger run docker buildx build -f containers/Dockerfile.sidecar --build-arg GO_VERSION=${GOLANG_IMAGE_VERSION}
329343
--tag localhost:{{.REGISTRY_PORT}}/sidecar-barman-cloud:testing --push .
330344
331345
internal:publish:
@@ -348,17 +362,19 @@ tasks:
348362
env:
349363
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
350364
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
365+
# renovate: datasource=docker depName=golang versioning=docker
366+
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
351367
internal: true
352368
cmds:
353369
- >
354370
GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
355371
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
356-
build --dir . --file containers/Dockerfile.plugin --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64 --platform linux/arm64
372+
build --dir . --file containers/Dockerfile.plugin --args GO_VERSION=${GOLANG_IMAGE_VERSION} --platform linux/amd64 --platform linux/arm64
357373
publish --ref {{.PLUGIN_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}
358374
- >
359375
GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
360376
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
361-
build --dir . --file containers/Dockerfile.sidecar --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64 --platform linux/arm64
377+
build --dir . --file containers/Dockerfile.sidecar --args GO_VERSION=${GOLANG_IMAGE_VERSION} --platform linux/amd64 --platform linux/arm64
362378
publish --ref {{.SIDECAR_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}
363379
364380
internal:controller-gen:
@@ -440,7 +456,7 @@ tasks:
440456
- internal:controller-gen
441457
env:
442458
# renovate: datasource=git-refs depName=crd-gen-refs lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
443-
DAGGER_CRDGENREF_SHA: 7174b66d283da487638a98b431b7707b311a9a32
459+
DAGGER_CRDGENREF_SHA: 26cd57fb6ad66e88c036b675b0478d38df93962d
444460
# renovate: datasource=go depName=github.com/elastic/crd-ref-docs
445461
CRDREFDOCS_VERSION: v0.3.0
446462
cmds:
@@ -538,8 +554,11 @@ tasks:
538554
.
539555
- rm -f {{ .KUBECONFIG_PATH }}
540556

557+
# Run e2e tests on the kind cluster specified by KIND_CLUSTER_NAME
541558
integration:e2e:
542559
desc: Run the e2e tests
560+
summary: |
561+
Run e2e against the Kind cluster specified by KIND_CLUSTER_NAME
543562
deps:
544563
- integration:deploy-to-kind
545564
run: once
@@ -555,14 +574,8 @@ tasks:
555574
sh: docker inspect --format '{{"{{"}} (index (index .HostConfig.PortBindings "6443/tcp") 0).HostPort {{"}}"}}' {{ .KIND_CLUSTER_NAME }}-control-plane
556575
cmds:
557576
- kind get kubeconfig --name {{ .KIND_CLUSTER_NAME }} > {{ .KUBECONFIG_PATH }}
558-
# kind writes the external server address as https://127.0.0.1:<port>, which is only valid on
559-
# the host. Rewrite it to the "kubernetes" alias that --svc below binds inside the dagger container.
560-
- >
561-
sed -i.bak "s#server: https://[^:]*:[0-9]*#server: https://kubernetes:{{ .KIND_HOSTPORT }}#" {{ .KUBECONFIG_PATH }}
577+
- defer: rm -f {{ .KUBECONFIG_PATH }}
562578
- >
563-
GITHUB_REF= dagger call -m dagger/e2e/ run
564-
--source .
565-
--kubeconfig {{.KUBECONFIG_PATH}}
566-
--svc tcp://127.0.0.1:{{.KIND_HOSTPORT}}
567-
--go-version {{.GO_VERSION}}
568-
- rm -f {{ .KUBECONFIG_PATH }} {{ .KUBECONFIG_PATH }}.bak
579+
kubectl --kubeconfig={{.KUBECONFIG_PATH}} config set-cluster kind-{{.KIND_CLUSTER_NAME}}
580+
--server=https://127.0.0.1:{{.KIND_HOSTPORT}} --insecure-skip-tls-verify=true
581+
- KUBECONFIG={{.KUBECONFIG_PATH}} go test ./test/e2e/... -v -ginkgo.v -timeout 45m

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/cloudnative-pg/plugin-barman-cloud
22

3-
go 1.26.4
3+
go 1.26.6
44

55
require (
66
github.com/cert-manager/cert-manager v1.21.1

0 commit comments

Comments
 (0)