-
Notifications
You must be signed in to change notification settings - Fork 3
/
.cirrus.yml
47 lines (41 loc) · 1.71 KB
/
.cirrus.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# share artifacts between tasks - build and upload in two different steps
#
# * https://github.com/yakshaveinc/linux/issues/33
container:
image: gcr.io/cloud-builders/git
cache33store_task:
build_script: |
apt-get update -y && apt-get install -y zip
COMMIT=$(git rev-parse HEAD)
FILENAME=yakshaveinc-${COMMIT}.zip
# -j - do not record directory names
# -r - descend inside
zip -jr ${FILENAME} bin/
# https://cirrus-ci.org/guide/writing-tasks/#http-cache
curl -s -X POST --data-binary @${FILENAME} http://$CIRRUS_HTTP_CACHE_HOST/${FILENAME}
cache33restore_task:
depends_on: cache33store
upload_script: |
COMMIT=$(git rev-parse HEAD)
FILENAME=yakshaveinc-${COMMIT}.zip
curl -O http://$CIRRUS_HTTP_CACHE_HOST/${FILENAME}
ls -la ${FILENAME}
# build and push Docker image with `snapcraft` tool
#
# * https://hub.docker.com/r/yakshaveinc/snapcraft/tags
# * https://forum.snapcraft.io/t/creating-docker-images-for-snapcraft/11739
docker_builder:
env:
TAG: yakshaveinc/snapcraft
CORE: core24
DOCKER_USERNAME: ENCRYPTED[89bc5b18538c2260d2840aa63a69b21ea4f247085793e6ddfc2270629b4f615b684dfca53a5f5debcabbe1b4f6d8b965]
DOCKER_PASSWORD: ENCRYPTED[5d5ec522913fd2c5b6dda34b044cdb55f01aae995150a98eba8a040a83126eb2e4b3e76209316aa3fe0af7ef8e4388ef]
build_script: |
docker build . -f Dockerfile.snapcraft -t $TAG:$CORE
test_script: docker run $TAG:$CORE snapcraft --version
deploy_script: |
# deploy is run only against master branch, because variables are not decrypted for read-only PR senders (for security)
if [ "$CIRRUS_BRANCH" == "master" ]; then
docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
docker push $TAG:$CORE
fi