From 84cae8d10a30a9f10d074e2977dc80efc382f691 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Tue, 4 Aug 2020 23:33:07 +0300 Subject: [PATCH 1/3] Add rsync to ignore .gitignore files when populating working directory Another option is to copy a statically linked rsync binary along with the agent's binary and call rsync from the context of task's container. --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index e8cd001..80eda4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,6 @@ ADD . /tmp/cirrus-ci-agent/ RUN goreleaser build --snapshot FROM alpine:latest + +RUN apk add --no-cache rsync COPY --from=builder /tmp/cirrus-ci-agent/dist/agent_linux_amd64/agent /bin/cirrus-ci-agent From f563c04c48a57b6e9692e550147038714ef9002d Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Tue, 4 Aug 2020 23:42:24 +0300 Subject: [PATCH 2/3] CI: ensure that Dockerfile actually builds --- .cirrus.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index b420cc9..8d358df 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -12,7 +12,11 @@ task: get_script: go get ./... build_script: go build ./... test_script: go test ./... - + +docker_builder: + name: Test Docker Build + build_script: docker build . + task: name: Build Binaries only_if: $CIRRUS_PR != '' @@ -26,7 +30,9 @@ task: task: name: Release only_if: $CIRRUS_TAG != '' - depends_on: Test + depends_on: + - Test + - Test Docker Build env: GITHUB_TOKEN: ENCRYPTED[!98ace8259c6024da912c14d5a3c5c6aac186890a8d4819fad78f3e0c41a4e0cd3a2537dd6e91493952fb056fa434be7c!] container: From 30681b1e7178144fb5c79dfb42bfa1d079998649 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Tue, 4 Aug 2020 23:48:57 +0300 Subject: [PATCH 3/3] CI: test docker build only if Dockerfile was changed Co-authored-by: Fedor Korotkov --- .cirrus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cirrus.yml b/.cirrus.yml index 8d358df..c96af0e 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -15,6 +15,7 @@ task: docker_builder: name: Test Docker Build + only_if: "changesInclude('Dockerfile')" build_script: docker build . task: