Skip to content

Commit e3dcdf2

Browse files
Merge pull request #39 from ecmwf-projects/build-from-versions-file
Build from versions file
2 parents 90c2f74 + d82f771 commit e3dcdf2

11 files changed

+251
-718
lines changed

.github/workflows/build-broker.yml

Lines changed: 16 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
description: 'Deployment branch'
88
required: true
99
default: 'main'
10+
build_mode:
11+
type: choice
12+
description: Build mode
13+
options:
14+
- dev
15+
- stable
1016
image_tag:
1117
description: 'Image tag'
1218
required: true
@@ -15,81 +21,14 @@ on:
1521
workflows:
1622
- ecmwf-projects/cads-build-farm/build-images.yml
1723
types: [requested]
18-
19-
24+
2025
jobs:
21-
22-
build-docker-image:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- name: Set up QEMU
26-
uses: docker/setup-qemu-action@v2
27-
28-
- name: Login to harbor registry
29-
uses: docker/login-action@v2
30-
with:
31-
registry: '${{ secrets.HARBOR_IP }}'
32-
username: ${{ secrets.HARBOR_USER }}
33-
password: ${{ secrets.HARBOR_TOKEN }}
34-
- name: Setup docker context for buildx
35-
id: buildx-context
36-
run: docker context create builders || docker context use builders
37-
- name: Create BuildKit Configuration
38-
run: |
39-
cat <<EOF > buildkitd.toml
40-
[registry."${{ secrets.HARBOR_IP }}"]
41-
http = false
42-
insecure = false
43-
ca=["/etc/ssl/certs/ca-certificates.crt"]
44-
EOF
45-
- name: Set up Docker Buildx
46-
uses: docker/setup-buildx-action@v2
47-
with:
48-
version: v0.9.1
49-
endpoint: builders
50-
buildkitd-flags: --debug
51-
config: buildkitd.toml
52-
53-
- name: Checkout cads-deployment repo
54-
uses: actions/checkout@v3
55-
with:
56-
repository: ecmwf-projects/cads-deployment
57-
ref: ${{ github.event.inputs.deployment_branch }}
58-
token: ${{ secrets.CADS_PAT }}
59-
path: .
60-
61-
- name: Checkout cacholote repo
62-
uses: actions/checkout@v3
63-
with:
64-
repository: ecmwf-projects/cacholote
65-
token: ${{ secrets.CADS_PAT }}
66-
path: ./docker/cacholote
67-
68-
- name: Clone cads-common repo
69-
uses: actions/checkout@v2
70-
with:
71-
repository: ecmwf-projects/cads-common
72-
token: ${{ secrets.CADS_PAT }}
73-
path: ./docker/cads-common
74-
75-
- name: Checkout cads-broker repo
76-
uses: actions/checkout@v3
77-
with:
78-
repository: ecmwf-projects/cads-broker
79-
token: ${{ secrets.CADS_PAT }}
80-
path: ./docker/cads-broker
81-
82-
- name: Checkout cads-worker repo
83-
uses: actions/checkout@v3
84-
with:
85-
repository: ecmwf-projects/cads-worker
86-
token: ${{ secrets.CADS_PAT }}
87-
path: ./docker/cads-worker
88-
89-
- name: Build and push
90-
uses: docker/build-push-action@v3
91-
with:
92-
context: docker
93-
push: true
94-
tags: ${{ secrets.HARBOR_IP }}/cads/broker:${{ github.event.inputs.image_tag }}
95-
file: docker/broker/Dockerfile
26+
build_broker:
27+
name: Build broker:${{ inputs.image_tag }} from ${{ inputs.build_mode }}
28+
uses: ecmwf-projects/cads-build-farm/.github/workflows/build-cads-image.yml@build-from-versions-file
29+
with:
30+
image_name: broker
31+
deployment_branch: ${{ inputs.deployment_branch }}
32+
build_mode: ${{ inputs.build_mode }}
33+
image_tag: ${{ inputs.image_tag }}
34+
secrets: inherit

.github/workflows/build-cache-cleaner.yml

Lines changed: 17 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
description: 'Deployment branch'
88
required: true
99
default: 'main'
10+
build_mode:
11+
type: choice
12+
description: Build mode
13+
options:
14+
- dev
15+
- stable
1016
image_tag:
1117
description: 'Image tag'
1218
required: true
@@ -15,75 +21,15 @@ on:
1521
workflows:
1622
- ecmwf-projects/cads-build-farm/build-images.yml
1723
types: [requested]
18-
24+
25+
1926
jobs:
20-
21-
build-docker-image:
22-
runs-on: ubuntu-latest
23-
steps:
24-
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@v2
26-
27-
- name: Login to harbor registry
28-
uses: docker/login-action@v2
29-
with:
30-
registry: "${{ secrets.HARBOR_IP }}"
31-
username: ${{ secrets.HARBOR_USER }}
32-
password: ${{ secrets.HARBOR_TOKEN }}
33-
- name: Setup docker context for buildx
34-
id: buildx-context
35-
run: docker context create builders || docker context use builders
36-
37-
- name: Create BuildKit Configuration
38-
run: |
39-
cat <<EOF > buildkitd.toml
40-
[registry."${{ secrets.HARBOR_IP }}"]
41-
http = false
42-
insecure = false
43-
ca=["/etc/ssl/certs/ca-certificates.crt"]
44-
EOF
45-
- name: Set up Docker Buildx
46-
uses: docker/setup-buildx-action@v2
47-
with:
48-
version: v0.9.1
49-
endpoint: builders
50-
buildkitd-flags: --debug
51-
config: buildkitd.toml
52-
53-
- name: Checkout cads-deployment repo
54-
uses: actions/checkout@v3
55-
with:
56-
repository: ecmwf-projects/cads-deployment
57-
ref: ${{ github.event.inputs.deployment_branch }}
58-
token: ${{ secrets.CADS_PAT }}
59-
path: .
60-
61-
- name: Checkout cacholote repo
62-
uses: actions/checkout@v3
63-
with:
64-
repository: ecmwf-projects/cacholote
65-
token: ${{ secrets.CADS_PAT }}
66-
path: ./docker/cacholote
67-
68-
- name: Checkout cads-worker repo
69-
uses: actions/checkout@v3
70-
with:
71-
repository: ecmwf-projects/cads-worker
72-
token: ${{ secrets.CADS_PAT }}
73-
path: ./docker/cads-worker
74-
75-
- name: Clone cads-common repo
76-
uses: actions/checkout@v2
77-
with:
78-
repository: ecmwf-projects/cads-common
79-
token: ${{ secrets.CADS_PAT }}
80-
path: ./docker/cads-common
81-
82-
- name: Build and push
83-
uses: docker/build-push-action@v3
84-
85-
with:
86-
context: docker
87-
push: true
88-
tags: ${{ secrets.HARBOR_IP }}/cads/cache-cleaner:${{ github.event.inputs.image_tag }}
89-
file: docker/cache-cleaner/Dockerfile
27+
build_cache_cleaner:
28+
name: Build cache-cleaner:${{ inputs.image_tag }} from ${{ inputs.build_mode }}
29+
uses: ecmwf-projects/cads-build-farm/.github/workflows/build-cads-image.yml@build-from-versions-file
30+
with:
31+
image_name: cache-cleaner
32+
deployment_branch: ${{ inputs.deployment_branch }}
33+
build_mode: ${{ inputs.build_mode }}
34+
image_tag: ${{ inputs.image_tag }}
35+
secrets: inherit
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build CADS image
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
deployment_branch:
7+
type: string
8+
required: true
9+
image_name:
10+
type: string
11+
required: true
12+
build_mode:
13+
type: string
14+
required: true
15+
image_tag:
16+
type: string
17+
required: true
18+
19+
jobs:
20+
build-docker-image:
21+
name: Build ${{inputs.image_name}}:${{ inputs.image_tag }} from ${{ inputs.build_mode }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v2
26+
27+
- name: Login to harbor registry
28+
uses: docker/login-action@v2
29+
with:
30+
registry: '${{ secrets.HARBOR_IP }}'
31+
username: ${{ secrets.HARBOR_USER }}
32+
password: ${{ secrets.HARBOR_TOKEN }}
33+
- name: Setup docker context for buildx
34+
id: buildx-context
35+
run: docker context create builders || docker context use builders
36+
37+
- name: Create BuildKit Configuration
38+
run: |
39+
cat <<EOF > buildkitd.toml
40+
[registry."${{ secrets.HARBOR_IP }}"]
41+
http = false
42+
insecure = false
43+
ca=["/etc/ssl/certs/ca-certificates.crt"]
44+
EOF
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v2
47+
with:
48+
version: v0.9.1
49+
endpoint: builders
50+
buildkitd-flags: --debug
51+
config: buildkitd.toml
52+
53+
- name: Checkout cads-deployment repo
54+
uses: actions/checkout@v3
55+
with:
56+
repository: ecmwf-projects/cads-deployment
57+
ref: ${{ inputs.deployment_branch }}
58+
token: ${{ secrets.CADS_PAT }}
59+
path: .
60+
61+
- name: Build and push
62+
uses: docker/build-push-action@v3
63+
with:
64+
context: docker
65+
push: true
66+
tags: ${{ secrets.HARBOR_IP }}/cads/${{ inputs.image_name }}:${{ inputs.image_tag }}
67+
file: docker/${{ inputs.image_name }}/Dockerfile
68+
build-args: |
69+
MODE=${{ inputs.build_mode }}
70+
CADS_PAT=${{ secrets.CADS_PAT }}
71+
GITHUB_TOKEN=${{ secrets.CADS_PAT }}
72+
GITHUB_EMAIL=${{ secrets.EMAIL_GITHUB }}
73+
GITHUB_USERNAME=${{ secrets.USERNAME_GITHUB }}

0 commit comments

Comments
 (0)