Skip to content

Commit

Permalink
ci: push downstream image to ocs/dev
Browse files Browse the repository at this point in the history
we have some changes related to downstream
so we need to have a seprate downstream image
o the ocs operator ci can make use of it

Signed-off-by: parth-gr <partharora1010@gmail.com>
  • Loading branch information
parth-gr committed Apr 3, 2024
1 parent c4611b1 commit 15848f1
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/push-build-downstream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Push Image Build Downstream
on:
push:
branches:
- master
- release-*
tags:
- v*
pull_request:
branches:
- master

defaults:
run:
# reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
shell: bash --noprofile --norc -eo pipefail -x {0}

permissions:
contents: read

jobs:
push-image-to-container-registry:
runs-on: ubuntu-20.04
if: github.repository == 'red-hat-storage/rook'
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: "1.21"

# docker/setup-qemu action installs QEMU static binaries, which are used to run builders for architectures other than the host.
- name: set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all

- name: log in to container registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_OCS_DEV_ROBOT_USER }}
password: ${{ secrets.QUAY_OCS_DEV_ROBOT_PASSWORD }}

# creating custom env var
- name: set env
run: |
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "GITHUB_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
- name: build and release
env:
BRANCH_NAME: ${{ env.BRANCH_NAME }}
GITHUB_SHA: $ {{ env.GITHUB_SHA }}
run: |
tests/scripts/build-release-downstream.sh
16 changes: 16 additions & 0 deletions tests/scripts/build-release-downstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -ex

# Load dot env file if available
if [ -f .env ]; then
# shellcheck disable=SC2046
export $(grep -v '^#' .env | xargs -d '\n')
fi

MAKE='make --debug=v --output-sync'
$MAKE build BUILD_REGISTRY=local
build_Image="local/ceph-amd64:latest"
git_hash=$(git rev-parse --short "${GITHUB_SHA}")
tag_Image=quay.io/ocs-dev/rook-ceph:v${BRANCH_NAME}-$git_hash
docker tag "$build_Image" "$tag_Image"
docker push "$tag_Image"

0 comments on commit 15848f1

Please sign in to comment.