Skip to content

Merge pull request #606 from ldevulder/fix-elemental-metadata-backup #30

Merge pull request #606 from ldevulder/fix-elemental-metadata-backup

Merge pull request #606 from ldevulder/fix-elemental-metadata-backup #30

Workflow file for this run

name : Branch head Prerelease Images
on:
push:
branches:
- main
- release/v[0-9]+.(0|x)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: docker.io
REPO : rancher
permissions:
contents: write
jobs:
prebuild-env:
name: Prebuild needed Env vars
runs-on : runs-on,image=ubuntu22-full-x64,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
steps:
- name: Check out the repository to the runner
uses: actions/checkout@v4
- name: Set Branch Tag and Other Variables
id: set-vars
run: bash ./.github/scripts/branch-tags.sh >> $GITHUB_OUTPUT
outputs:
branch_tag: ${{ steps.set-vars.outputs.branch_tag }}
branch_static_tag: ${{ steps.set-vars.outputs.branch_static_tag }}
prev_tag: ${{ steps.set-vars.outputs.prev_tag }}
push:
needs : [
prebuild-env,
]
permissions:
contents : read
id-token: write
name : Build and push BRO images
runs-on : runs-on,image=ubuntu22-full-x64,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
steps:
- name : "Read vault secrets"
uses : rancher-eio/read-vault-secrets@main
if: ${{ github.repository_owner == 'rancher' }}
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name : Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.DOCKER_USERNAME || vars.REPO }}
password: ${{ env.DOCKER_PASSWORD || secrets.DOCKER_PW }}
- name: Build and push BRO image
env:
FULL_IMAGE_URL: "${{ env.REGISTRY }}/${{ vars.REPO || env.REPO || github.repository_owner }}/backup-restore-operator"
uses: docker/build-push-action@v6
with:
context: .
file: ./package/Dockerfile
build-args: |
TAG=${{ needs.prebuild-env.outputs.branch_static_tag }}
push: true
tags: ${{ env.FULL_IMAGE_URL }}:${{ needs.prebuild-env.outputs.branch_static_tag }}
platforms: linux/amd64,linux/arm64
- name: Update rolling tag to new static tag
env:
FULL_IMAGE_URL: ${{ env.REGISTRY }}/${{ vars.REPO || env.REPO || github.repository_owner }}/backup-restore-operator
run: |
VERSION="1.2.0"
curl -LO "https://github.com/oras-project/oras/releases/download/v${VERSION}/oras_${VERSION}_linux_amd64.tar.gz"
mkdir -p oras-install/
tar -zxf oras_${VERSION}_*.tar.gz -C oras-install/
oras-install/oras copy ${{ env.FULL_IMAGE_URL }}:${{ needs.prebuild-env.outputs.branch_static_tag }} ${{ env.FULL_IMAGE_URL }}:${{ needs.prebuild-env.outputs.branch_tag }}