[DNM] update containers check #37
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
name: OpenStackAnsibleEE runner image builder | |
on: | |
push: | |
branches: | |
- '*' | |
paths-ignore: | |
- .gitignore | |
- .pull_request_pipeline | |
- LICENSE | |
- README.rst | |
- .github/ | |
- docs/ | |
- tests/ | |
env: | |
imageregistry: 'quay.io' | |
imagenamespace: ${{ secrets.IMAGENAMESPACE || secrets.QUAY_USERNAME }} | |
latesttag: latest | |
jobs: | |
check-secrets: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check secrets are set | |
id: have-secrets | |
if: "${{ env.imagenamespace != '' }}" | |
run: echo "ok=true" >> $GITHUB_OUTPUT | |
outputs: | |
have-secrets: ${{ steps.have-secrets.outputs.ok }} | |
build-openstack-ansibleee-runner: | |
name: Build openstack-ansibleee-runner image using buildah | |
runs-on: ubuntu-latest | |
needs: [check-secrets] | |
if: needs.check-secrets.outputs.have-secrets == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v5 | |
- name: Set latest tag for non main branch | |
if: "${{ steps.branch-name.outputs.current_branch != 'main' }}" | |
run: | | |
echo "latesttag=${{ steps.branch-name.outputs.current_branch }}-latest" >> $GITHUB_ENV | |
- name: Buildah Action | |
id: build-openstack-ansibleee-runner | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: openstack-ansibleee-runner | |
tags: ${{ env.latesttag }} ${{ github.sha }} | |
containerfiles: | | |
./openstack_ansibleee/Dockerfile | |
- name: Push openstack-ansibleee-runner To ${{ env.imageregistry }} | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-openstack-ansibleee-runner.outputs.image }} | |
tags: ${{ steps.build-openstack-ansibleee-runner.outputs.tags }} | |
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }} | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} |