Skip to content

Commit

Permalink
Pass env. vars to called
Browse files Browse the repository at this point in the history
Skip-PR-comments: true
Run-GHA: true

Required-githooks: true

Signed-off-by: Brian J. Murrell <[email protected]>
  • Loading branch information
brianjmurrell committed Apr 24, 2024
1 parent fa4f8d0 commit c81d2b1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/rpm-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,32 @@ defaults:
permissions: {}

jobs:
variables:
name: Compute outputs
runs-on: ubuntu-latest
outputs:
NAME: ${{ env.NAME }}
DISTROS: ${{ env.DISTROS }}
EL8_BUILD_VERSION: ${{ env.EL8_BUILD_VERSION }}
EL9_BUILD_VERSION: ${{ env.EL9_BUILD_VERSION }}
PACKAGING_DIR: ${{ env.PACKAGING_DIR }}
steps:
- name: Echo
if: false
run: echo

call-rpm-build:
name: Build RPM
needs: variables
permissions:
statuses: write
uses: ./.github/workflows/rpm-build.yml
secrets: inherit
with:
NAME: ${{ needs.variables.outputs.NAME }}
DISTROS: ${{ needs.variables.outputs.DISTROS }}
EL8_BUILD_VERSION: ${{ needs.variables.outputs.EL8_BUILD_VERSION }}
EL9_BUILD_VERSION: ${{ needs.variables.outputs.EL9_BUILD_VERSION }}
PACKAGING_DIR: ${{ needs.variables.outputs.PACKAGING_DIR}}

Test-with-DAOS:
# TODO: investigate how cancelling this can cancel the downstream job
Expand Down
30 changes: 23 additions & 7 deletions .github/workflows/rpm-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ name: RPM Build

on:
workflow_call:
inputs:
NAME:
type: string
required: true
DISTROS:
type: string
required: true
EL8_BUILD_VERSION:
type: string
required: true
EL9_BUILD_VERSION:
type: string
required: true
PACKAGING_DIR:
type: string
required: true

jobs:
# it's a real shame that this step is even needed. push events have the commit message in
Expand Down Expand Up @@ -91,7 +107,7 @@ jobs:
steps:
- name: Set name variable
id: name
run: echo 'text=${{ env.NAME }}' >> $GITHUB_OUTPUT
run: echo 'text=${{ inputs.NAME }}' >> $GITHUB_OUTPUT

Create-symlinks:
# you might think this is an odd place to do this and it should be done as a result of the
Expand Down Expand Up @@ -156,7 +172,7 @@ jobs:
if ${CP_SKIP_BUILD:-false}; then
exit 0
fi
distros=(${{ env.DISTROS }})
distros=(${{ input.DISTROS }})
if ! ${CP_SKIP_BUILD_EL8_RPM:-false} && [[ ${distros[@]} =~ el8 ]]; then
l+=(el8)
fi
Expand All @@ -176,7 +192,7 @@ jobs:
if ${CP_SKIP_BUILD:-false}; then
exit 0
fi
distros=(${{ env.DISTROS }})
distros=(${{ input.DISTROS }})
if ! ${CP_SKIP_BUILD_EL8_RPM:-false} && [[ ${distros[@]} =~ el8 ]]; then
l+=('"el8"')
fi
Expand Down Expand Up @@ -245,13 +261,13 @@ jobs:
'el8')
CHROOT_NAME="rocky+epel-8-x86_64"
DISTRO_NAME="EL"
DISTRO_VERSION='${{ env.EL8_BUILD_VERSION }}'
DISTRO_VERSION='${{ inputs.EL8_BUILD_VERSION }}'
COMMIT_STATUS_DISTRO_VERSION="8"
;;
'el9')
CHROOT_NAME="rocky+epel-9-x86_64"
DISTRO_NAME="EL"
DISTRO_VERSION='${{ env.EL9_BUILD_VERSION }}'
DISTRO_VERSION='${{ inputs.EL9_BUILD_VERSION }}'
;;
'leap15')
CHROOT_NAME='opensuse-leap-${{ env.CP_LEAP15_VERSION &&
Expand All @@ -276,14 +292,14 @@ jobs:
- name: Build RPM Docker image
id: build-rpm-docker-image
continue-on-error: true
run: docker build --file ${{ env.PACKAGING_DIR }}/packaging/Dockerfile.mockbuild
run: docker build --file ${{ inputs.PACKAGING_DIR }}/packaging/Dockerfile.mockbuild
--build-arg CACHEBUST=$(date +%s%3N)
--build-arg CB0=$(date +%V)
--build-arg REPO_FILE_URL=$REPO_FILE_URL
--build-arg UID=$(id -u)
--build-arg FVERSION=${{ env.FVERSION }}
--tag mock-build
${{ env.PACKAGING_DIR }}
${{ inputs.PACKAGING_DIR }}
- name: Build RPM
id: build-rpm
continue-on-error: true
Expand Down

0 comments on commit c81d2b1

Please sign in to comment.