Skip to content

Commit

Permalink
Merge pull request #49 from tapis-project/gha_dependent_jobs_dbg
Browse files Browse the repository at this point in the history
Github workflow updates:

- Make sure dependent jobs complete before starting a job.
- Allow build of non-default pyevents branch.
- Trigger workflow on merge request to main.
  • Loading branch information
khsa1 authored Jan 21, 2025
2 parents 47f790d + dfdd729 commit 5bd5c0c
Showing 1 changed file with 58 additions and 3 deletions.
61 changes: 58 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Docker Image CI
on:
release:
types: [released]
pull_request:
branches:
- master
push:
branches:
- dev
Expand All @@ -12,6 +15,11 @@ on:
description: ''
required: true
type: string
pyevents_branch:
default: 'main'
description: ''
required: false
type: string

jobs:
engine:
Expand All @@ -24,6 +32,8 @@ jobs:
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -56,14 +66,24 @@ jobs:
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
PYEVENTS_BRANCH=${{ inputs.pyevents_branch }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
PYEVENTS_BRANCH=main
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
PYEVENTS_BRANCH=main
else
TRAPS_REL=${{ github.event.release.tag_name }}
PYEVENTS_BRANCH=main
fi
echo "TRAPS_REL=$TRAPS_REL" >> "$GITHUB_ENV"
echo "PYEVENTS_BRANCH=$PYEVENTS_BRANCH" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
with:
repository: tapis-project/event-engine
ref: ${{ env.PYEVENTS_BRANCH }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -76,7 +96,7 @@ jobs:
- name: Build and push pyevents
uses: docker/build-push-action@v5
with:
context: https://github.com/tapis-project/event-engine.git#:pyevents
context: pyevents
platforms: linux/amd64,linux/arm64
push: true
tags: tapis/pyevents
Expand All @@ -89,14 +109,24 @@ jobs:
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
PYEVENTS_BRANCH=${{ inputs.pyevents_branch }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
PYEVENTS_BRANCH=main
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
PYEVENTS_BRANCH=main
else
TRAPS_REL=${{ github.event.release.tag_name }}
PYEVENTS_BRANCH=main
fi
echo "TRAPS_REL=$TRAPS_REL" >> "$GITHUB_ENV"
echo "PYEVENTS_BRANCH=$PYEVENTS_BRANCH" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v4
with:
repository: tapis-project/event-engine
ref: ${{ env.PYEVENTS_BRANCH }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -109,22 +139,25 @@ jobs:
- name: Build and push pyevents:3.8
uses: docker/build-push-action@v5
with:
context: https://github.com/tapis-project/event-engine.git#:pyevents
file: https://raw.githubusercontent.com/tapis-project/event-engine/main/pyevents/Dockerfile-3.8
context: pyevents
file: pyevents/Dockerfile-3.8
platforms: linux/amd64,linux/arm64
push: true
tags: tapis/pyevents:3.8

camera_traps_py:
runs-on: ubuntu-latest
environment: main
needs: [pyevents, pyevents_38]
steps:
- name: Set TRAPS_REL
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand All @@ -151,13 +184,16 @@ jobs:
camera_traps_py_38:
runs-on: ubuntu-latest
environment: main
needs: [pyevents, pyevents_38]
steps:
- name: Set TRAPS_REL
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -185,13 +221,16 @@ jobs:
image_scoring_plugin_py_38:
runs-on: ubuntu-latest
environment: main
needs: camera_traps_py_38
steps:
- name: Set TRAPS_REL
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -226,13 +265,16 @@ jobs:
image_scoring_plugin_py_nano_38:
runs-on: ubuntu-latest
environment: main
needs: camera_traps_py_38
steps:
- name: Set TRAPS_REL
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -267,13 +309,16 @@ jobs:
image_generating_plugin:
runs-on: ubuntu-latest
environment: main
needs: camera_traps_py
steps:
- name: Set TRAPS_REL
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -301,13 +346,16 @@ jobs:
power_measuring_plugin:
runs-on: ubuntu-latest
environment: main
needs: camera_traps_py
steps:
- name: Set TRAPS_REL
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -335,13 +383,16 @@ jobs:
oracle_plugin:
runs-on: ubuntu-latest
environment: main
needs: camera_traps_py
steps:
- name: Set TRAPS_REL
run: |
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -376,6 +427,8 @@ jobs:
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down Expand Up @@ -410,6 +463,8 @@ jobs:
TRAPS_REL=${{ inputs.release_tag }}
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
TRAPS_REL=latest
elif [[ ${{ github.event_name == 'pull_request' }} == true ]]; then
TRAPS_REL=latest
else
TRAPS_REL=${{ github.event.release.tag_name }}
fi
Expand Down

0 comments on commit 5bd5c0c

Please sign in to comment.