-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
95 lines (90 loc) · 3.92 KB
/
.gitlab-ci.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
stages:
- build
variables:
BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64
BUILDX_BUILDER: firefly_builder
BUILDX_PLATFORM: linux/amd64,linux/arm64
build_master:
image: docker:git
stage: build
services:
- name: docker:dind
command: ["--experimental"]
before_script:
- mkdir -p $HOME/.docker/cli-plugins
- wget -O $HOME/.docker/cli-plugins/docker-buildx $BUILDX_URL
- chmod a+x $HOME/.docker/cli-plugins/docker-buildx
- "echo -e '{\n \"experimental\": \"enabled\"\n}' | tee $HOME/.docker/config.json"
- docker run --rm --privileged multiarch/qemu-user-static:4.2.0-7 --reset -p yes
- docker buildx create --use --driver docker-container --name ${BUILDX_BUILDER} --platform ${BUILDX_PLATFORM}
- docker buildx inspect --bootstrap ${BUILDX_BUILDER}
- docker buildx ls
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker buildx build --platform $BUILDX_PLATFORM -t registry.gitlab.com/georgehahn/firefly-plaid-connector:latest --push .
only:
- master
build_tag:
image: docker:git
stage: build
services:
- name: docker:dind
command: ["--experimental"]
before_script:
- mkdir -p $HOME/.docker/cli-plugins
- wget -O $HOME/.docker/cli-plugins/docker-buildx $BUILDX_URL
- chmod a+x $HOME/.docker/cli-plugins/docker-buildx
- "echo -e '{\n \"experimental\": \"enabled\"\n}' | tee $HOME/.docker/config.json"
- docker run --rm --privileged multiarch/qemu-user-static:4.2.0-7 --reset -p yes
- docker buildx create --use --driver docker-container --name ${BUILDX_BUILDER} --platform ${BUILDX_PLATFORM}
- docker buildx inspect --bootstrap ${BUILDX_BUILDER}
- docker buildx ls
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker buildx build --platform $BUILDX_PLATFORM -t registry.gitlab.com/georgehahn/firefly-plaid-connector:${CI_COMMIT_TAG} --push .
only:
- tags
# Build MRs automatically
build_MR:
image: docker:git
stage: build
services:
- name: docker:dind
command: ["--experimental"]
before_script:
- mkdir -p $HOME/.docker/cli-plugins
- wget -O $HOME/.docker/cli-plugins/docker-buildx $BUILDX_URL
- chmod a+x $HOME/.docker/cli-plugins/docker-buildx
- "echo -e '{\n \"experimental\": \"enabled\"\n}' | tee $HOME/.docker/config.json"
- docker run --rm --privileged multiarch/qemu-user-static:4.2.0-7 --reset -p yes
- docker buildx create --use --driver docker-container --name ${BUILDX_BUILDER} --platform ${BUILDX_PLATFORM}
- docker buildx inspect --bootstrap ${BUILDX_BUILDER}
- docker buildx ls
script:
- docker buildx build --platform $BUILDX_PLATFORM -t registry.gitlab.com/georgehahn/firefly-plaid-connector:MR-${CI_MERGE_REQUEST_IID}-${CI_COMMIT_REF_SLUG} .
except:
- master
- tags
# Push MRs when manually authorized. This has to rebuild the container due to multiplat limitations in docker buildx.
build_and_push_MR:
image: docker:git
stage: build
services:
- name: docker:dind
command: ["--experimental"]
before_script:
- mkdir -p $HOME/.docker/cli-plugins
- wget -O $HOME/.docker/cli-plugins/docker-buildx $BUILDX_URL
- chmod a+x $HOME/.docker/cli-plugins/docker-buildx
- "echo -e '{\n \"experimental\": \"enabled\"\n}' | tee $HOME/.docker/config.json"
- docker run --rm --privileged multiarch/qemu-user-static:4.2.0-7 --reset -p yes
- docker buildx create --use --driver docker-container --name ${BUILDX_BUILDER} --platform ${BUILDX_PLATFORM}
- docker buildx inspect --bootstrap ${BUILDX_BUILDER}
- docker buildx ls
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker buildx build --platform $BUILDX_PLATFORM -t registry.gitlab.com/georgehahn/firefly-plaid-connector:MR-${CI_MERGE_REQUEST_IID}-${CI_COMMIT_REF_SLUG} --push .
when: manual
except:
- master
- tags