-
Notifications
You must be signed in to change notification settings - Fork 3
129 lines (107 loc) · 3.99 KB
/
build-images.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
# desc: build container images, perform static tests then push
# this workflow will only use current as tag container tag reference, dedicated workflow exists for releasing versionned image
name: build-images
on:
push:
pull_request_target:
jobs:
lint:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
build-image:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install if required common software tooling
uses: camunda/infra-global-github-actions/common-tooling@main
with:
java-enabled: false
yarn-enabled: false
- name: Build image using Camunda docker build
id: build-image-step
uses: camunda/infra-global-github-actions/build-docker-image@feature/container-build-multiarch
with:
registry_host: ${{ vars.CONTAINER_REGISTRY }}
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}
force_push: true
image_name: ${{ vars.CONTAINER_IMAGE_NAME }}
build_context: .
build_platforms: linux/amd64,linux/arm64
- name: Compute target built image fully qualified name from metadata
id: compute-image-name-step
run: |
image_metadata="${{ steps.build-image-step.outputs.image_metadata }}"
image_name=$(echo "$image_metadata" | jq -r '.image.name')
digest=$(echo "$image_metadata" | jq -r '.containerimage.digest')
full_image_name="${image_name}:${digest}"
echo "full_image_name=${full_image_name}" >> $GITHUB_ENV
echo "::set-output name=full_image_name::${full_image_name}"
test-base-image:
runs-on: ubuntu-latest
needs:
- build-image
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install if required common software tooling
uses: camunda/infra-global-github-actions/common-tooling@main
with:
java-enabled: false
yarn-enabled: false
- name: Login to the registry
uses: docker/login-action@v3
with:
registry: ${{ vars.CONTAINER_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: KeyCloak Show-Config
run: |
docker run ${{ needs.build-image.outputs.full_image_name }} show-config >> docker.log
echo "config=$(cat docker.log | tr '\n' ' ')" >> "$GITHUB_ENV"
- name: Assert Config
env:
CONFIG: ${{ env.config }}
run: python3 ./.github/scripts/build-check/main.py
test-postgres-integ:
runs-on: ubuntu-22.04
needs:
- build-image
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install if required common software tooling
uses: camunda/infra-global-github-actions/common-tooling@main
with:
java-enabled: false
yarn-enabled: false
- name: Login to the registry
uses: docker/login-action@v3
with:
registry: ${{ vars.CONTAINER_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Start Test Environment
uses: ./.github/actions/compose
with:
compose_file: ${{ github.workspace }}/docker-compose.yml
project_name: keycloak
env:
COMPOSE_KEYCLOAK_IMAGE: ${{ needs.build-image.outputs.full_image_name }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./.github/scripts/integration/requirements.txt
- name: Test Environment
run: python3 ./.github/scripts/integration/main.py
# TODO: add tests (static framework tbd) then push
# TODO: implement
# publish-image:
# release: