Skip to content

Commit

Permalink
ensure wafv5 base images are created (nginxinc#5771)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdabelf5 authored and ssrahul96 committed Jun 20, 2024
1 parent 2601224 commit 0dd9359
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build-base-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,22 @@ jobs:
- image: alpine-plus-nap-fips
platforms: "linux/amd64"
nap_modules: waf
- image: alpine-plus-nap-v5-fips
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
- image: debian-plus-nap-v5
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
- image: ubi-9-plus-nap-v5
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
- image: ubi-8-plus-nap-v5
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
steps:
- name: Checkout Repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build-oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ jobs:
- name: Check if base images exist
id: base_exists
run: |
if docker manifest inspect gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/oss:${{ inputs.base-image-md5 }}-${{ inputs.image }}; then
echo "exists=0" >> $GITHUB_OUTPUT
else
echo "exists=1" >> $GITHUB_OUTPUT
base_image="gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/oss:${{ inputs.base-image-md5 }}-${{ inputs.image }}"
echo "image=${base_image}" >> $GITHUB_OUTPUT
if docker manifest inspect ${base_image}; then
echo "exists=true" >> $GITHUB_OUTPUT
fi
if: ${{ ! inputs.forked-workflow }}

Expand All @@ -136,14 +136,14 @@ jobs:
cache-from: type=gha,scope=${{ inputs.image }}
cache-to: type=gha,scope=${{ inputs.image }},mode=max
target: common
tags: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/oss:${{ inputs.base-image-md5 }}-${{ inputs.image }}
tags: ${{ steps.base_exists.outputs.image }}
platforms: ${{ inputs.platforms }}
pull: true
push: true
build-args: |
BUILD_OS=${{ inputs.image }}
IC_VERSION=${{ inputs.tag }}
if: ${{ ! inputs.forked-workflow && steps.base_exists.outputs.exists != 0 }}
if: ${{ ! inputs.forked-workflow && steps.base_exists.outputs.exists != 'true' }}

- name: Get short tag
id: tag
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
provenance: false
build-args: |
BUILD_OS=${{ inputs.image }}
${{ ! inputs.forked-workflow && format('PREBUILT_BASE_IMG=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/oss:{0}-{1}', inputs.base-image-md5, inputs.image) || '' }}
${{ ! inputs.forked-workflow && format('PREBUILT_BASE_IMG={0}', steps.base_exists.outputs.image) || '' }}
IC_VERSION=${{ (github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/release-')) && 'CI' || steps.meta.outputs.version }}
- name: Certify Images
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build-plus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ jobs:
- name: Check if base images exist
id: base_exists
run: |
if docker manifest inspect gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/plus:${{ inputs.base-image-md5 }}-${{ inputs.image }}${{ steps.nap_modules.outputs.name != '' && format('-{0}', steps.nap_modules.outputs.name) || '' }}; then
echo "exists=0" >> $GITHUB_OUTPUT
else
echo "exists=1" >> $GITHUB_OUTPUT
base_image="gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/plus:${{ inputs.base-image-md5 }}-${{ inputs.image }}${{ steps.nap_modules.outputs.name != '' && format('-{0}', steps.nap_modules.outputs.name) || '' }}${{ contains(inputs.image, 'v5') && '-v5' || '' }}"
echo "image=${base_image}" >> $GITHUB_OUTPUT
if docker manifest inspect ${base_image}; then
echo "exists=true" >> $GITHUB_OUTPUT
fi
if: ${{ ! inputs.forked-workflow }}

Expand All @@ -168,7 +168,7 @@ jobs:
cache-from: type=gha,scope=${{ inputs.image }}${{ steps.nap_modules.outputs.name != '' && format('-{0}', steps.nap_modules.outputs.name) || '' }}
cache-to: type=gha,scope=${{ inputs.image }}${{ steps.nap_modules.outputs.name != '' && format('-{0}', steps.nap_modules.outputs.name) || '' }},mode=max
target: common
tags: gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/plus:${{ inputs.base-image-md5 }}-${{ inputs.image }}${{ steps.nap_modules.outputs.name != '' && format('-{0}', steps.nap_modules.outputs.name) || '' }}
tags: ${{ steps.base_exists.outputs.image }}
platforms: ${{ inputs.platforms }}
pull: true
push: true
Expand All @@ -180,7 +180,7 @@ jobs:
"nginx-repo.crt=${{ inputs.nap_modules != '' && secrets.NGINX_AP_CRT || secrets.NGINX_CRT }}"
"nginx-repo.key=${{ inputs.nap_modules != '' && secrets.NGINX_AP_KEY || secrets.NGINX_KEY }}"
${{ inputs.nap_modules != '' && contains(inputs.image, 'ubi') && format('"rhel_license={0}"', secrets.RHEL_LICENSE) || '' }}
if: ${{ ! inputs.forked-workflow && steps.base_exists.outputs.exists != 0 }}
if: ${{ ! inputs.forked-workflow && steps.base_exists.outputs.exists != 'true' }}

- name: Build Plus Docker image
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0
Expand All @@ -202,7 +202,7 @@ jobs:
provenance: false
build-args: |
BUILD_OS=${{ inputs.image }}
PREBUILT_BASE_IMG=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic-base/plus:${{ inputs.base-image-md5 }}-${{ inputs.image }}${{ steps.nap_modules.outputs.name != '' && format('-{0}', steps.nap_modules.outputs.name) || '' }}
${{ ! inputs.forked-workflow && format('PREBUILT_BASE_IMG={0}', steps.base_exists.outputs.image) || '' }}
IC_VERSION=${{ (github.ref_type == 'tag' && vars.OLD_RELEASE_FLOW == 'true') && steps.meta.outputs.version || 'CI' }}
${{ inputs.nap_modules != '' && format('NAP_MODULES={0}', steps.nap_modules.outputs.modules) || '' }}
${{ contains(inputs.image, 'v5') && 'WAF_VERSION=v5' || '' }}
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/cache-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,22 @@ jobs:
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
- image: alpine-plus-nap-v5-fips
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
- image: debian-plus-nap-v5
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
- image: ubi-9-plus-nap-v5
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
- image: ubi-8-plus-nap-v5
target: goreleaser
platforms: "linux/amd64"
nap_modules: waf
uses: ./.github/workflows/build-plus.yml
with:
platforms: ${{ matrix.platforms }}
Expand Down

0 comments on commit 0dd9359

Please sign in to comment.