Skip to content

Commit

Permalink
Adapt Docker workflow according to new system tests design (#186)
Browse files Browse the repository at this point in the history
* - modify args to fit to systemtest
- make the manual triggering more useful
- move latest tag to last master

* bash string handling... Fun stuff

* sprinkle in some "

* adding some "debug" ouptut

* Update .github/workflows/build-docker.yml

Co-authored-by: Gerasimos Chourdakis <[email protected]>

* Update .github/workflows/build-docker.yml

Co-authored-by: Gerasimos Chourdakis <[email protected]>

---------

Co-authored-by: Valentin Seitz <[email protected]>
Co-authored-by: Gerasimos Chourdakis <[email protected]>
  • Loading branch information
3 people authored and BenjaminRodenberg committed Aug 27, 2024
1 parent 8a02cea commit cc7a607
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
38 changes: 32 additions & 6 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
name: Update docker image

on:
workflow_dispatch: # Trigger by hand from the UI
workflow_dispatch: # Trigger by hand from the UI
inputs:
branch:
type: choice
description: branch to build the image from
options:
- develop
- master
push:
branches:
- develop
- master


jobs:
build-and-release-docker-image:
Expand All @@ -13,10 +22,26 @@ jobs:
env:
docker_username: precice
steps:
- name: Get branch name
if: github.event_name != 'pull_request'
- name: Set branch name for manual triggering
if: github.event_name == 'workflow_dispatch'
shell: bash
run: echo "BINDINGS_REF=${{ inputs.branch }}" >> $GITHUB_ENV
- name: Set branch name for "on pull request" triggering
if: github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch'
shell: bash
run: echo "BINDINGS_REF=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Set PRECICE_TAG and the TAG depending on branch
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
run: |
if [[ '${{ env.BINDINGS_REF }}' == 'master' ]]; then
echo "PRECICE_TAG=latest" >> "$GITHUB_ENV"
echo "TAG=latest" >> "$GITHUB_ENV"
echo "Building TAG: latest"
else
echo "PRECICE_TAG=${{ env.BINDINGS_REF }}" >> "$GITHUB_ENV"
echo "TAG=${{ env.BINDINGS_REF }}" >> "$GITHUB_ENV"
echo "Building TAG: ${{ env.BINDINGS_REF }}"
fi
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
Expand All @@ -31,6 +56,7 @@ jobs:
with:
push: true
file: "./tools/releasing/packaging/docker/Dockerfile"
tags: ${{ env.docker_username }}/python-bindings:${{ env.branch }},${{ env.docker_username }}/python-bindings:latest
tags: ${{ env.docker_username }}/python-bindings:${{ env.TAG }}
build-args: |
branch=${{ env.branch }}
PRECICE_TAG=${{ env.PRECICE_TAG }}
PYTHON_BINDINGS_REF=${{ env.BINDINGS_REF }}
9 changes: 4 additions & 5 deletions tools/releasing/packaging/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dockerfile to build a ubuntu image containing the installed Debian package of a release
ARG branch=develop
ARG from=precice/precice:latest
ARG PRECICE_TAG=develop
ARG from=precice/precice:${PRECICE_TAG}
FROM $from

USER root
Expand Down Expand Up @@ -41,8 +41,7 @@ SHELL ["/bin/bash", "-c"]
RUN python3 -m pip install --user --upgrade pip

# Rebuild image if force_rebuild after that command
ARG CACHEBUST
ARG branch=develop
ARG PYTHON_BINDINGS_REF=develop

# Builds the precice python bindings for python3
RUN pip3 install --user git+https://github.com/precice/python-bindings.git@$branch
RUN pip3 install --user git+https://github.com/precice/python-bindings.git@${PYTHON_BINDINGS_REF}

0 comments on commit cc7a607

Please sign in to comment.