refactor: Lint all docker files with Hadolint #1280
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | |
# SPDX-License-Identifier: CC0-1.0 | |
name: Build & push images | |
on: | |
push: | |
pull_request: | |
branches: ["main"] | |
env: | |
registry: ghcr.io/dsd-dbs/capella-dockerimages/ | |
images: capella/base capella/remote capella/ease capella/readonly | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install pre-commit | |
run: |- | |
python -m pip install pre-commit | |
- name: Run pre-commit | |
run: |- | |
pre-commit run --all-files | |
deploy-docker-images: | |
runs-on: ubuntu-latest | |
needs: [lint] | |
strategy: | |
matrix: | |
capella_version: | |
- "5.0.0" | |
- "5.2.0" | |
- "6.0.0" | |
- "6.1.0" | |
dropins: | |
- name: "without" # without dropins | |
dropins: "" | |
- name: "selected" | |
dropins: "CapellaXHTMLDocGen,DiagramStyler,PVMT,Filtering,Requirements,SubsystemTransition" # selected set of dropins | |
name: Capella ${{ matrix.capella_version }} with ${{ matrix.dropins.name }} dropins | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4.3.0 | |
with: | |
cache: pip | |
cache-dependency-path: ./pyproject.toml | |
python-version: "3.11" | |
- name: Login to github container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set outputs | |
id: tag | |
run: | | |
echo "branch=$(git rev-parse --abbrev-ref HEAD | sed 's/[^a-zA-Z0-9]/-/g')" >> "$GITHUB_OUTPUT" | |
echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Build | |
run: > | |
make ${{ env.images }} | |
CAPELLA_VERSIONS="${{ matrix.capella_version }}" | |
DOCKER_PREFIX="${{ env.registry }}" | |
CAPELLA_DOCKERIMAGES_REVISION="${{ steps.tag.outputs.branch }}" | |
CAPELLA_DROPINS="${{ matrix.dropins.dropins }}" | |
DOCKER_TAG_SCHEMA=${{ matrix.capella_version }}-${{ matrix.dropins.name }}-dropins-${{ steps.tag.outputs.branch }} | |
DOCKER_BUILD_FLAGS="--label git-short-sha=${{ steps.tag.outputs.sha }}" | |
- name: Install test dependencies | |
run: | | |
docker build $DOCKER_BUILD_ARGS -t local-git-server tests/local-git-server | |
pip install . | |
- name: Run pytest | |
run: > | |
DOCKER_PREFIX="${{ env.registry }}" | |
DOCKER_TAG="${{ matrix.capella_version }}-${{ matrix.dropins.name }}-dropins-${{ steps.tag.outputs.branch }}" | |
CAPELLA_VERSION="${{ matrix.capella_version }}" | |
LOCAL_GIT_TAG="latest" | |
pytest -m "not (t4c_server or t4c)" tests | |
- name: Push | |
run: | | |
for image in ${{ env.images }} | |
do docker push "${{ env.registry }}$image:${{ matrix.capella_version }}-${{ matrix.dropins.name }}-dropins-${{ steps.tag.outputs.branch }}" | |
done |