Skip to content

fix ci

fix ci #9

Workflow file for this run

---
# 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}" | tr -d '\n' | jq -r '."image.name"')
digest=$(echo "${image_metadata}" | tr -d '\n' | 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: