Skip to content

Commit

Permalink
Update workflows (#4180)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Aug 8, 2023
1 parent 6c40113 commit 7122954
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build-plus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,22 @@ jobs:
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_ROLE_MARKETPLACE }}
if: startsWith(github.ref, 'refs/tags/') && contains(inputs.target, 'aws')
if: github.ref_type == 'tag' && contains(inputs.target, 'aws')

- name: Login to ECR
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: 709825985650.dkr.ecr.us-east-1.amazonaws.com
if: startsWith(github.ref, 'refs/tags/') && contains(inputs.target, 'aws')
if: github.ref_type == 'tag' && contains(inputs.target, 'aws')

- name: Docker meta
id: meta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0
with:
images: |
name=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/nginx-ic${{ contains(inputs.nap_modules, 'dos') && '-dos' || '' }}${{ contains(inputs.nap_modules, 'waf') && '-nap' || '' }}/nginx-plus-ingress
name=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/release/nginx-ic${{ contains(inputs.nap_modules, 'dos') && '-dos' || '' }}${{ contains(inputs.nap_modules, 'waf') && '-nap' || '' }}/nginx-plus-ingress,enable=${{ startsWith(github.ref, 'refs/tags/') }}
name=709825985650.dkr.ecr.us-east-1.amazonaws.com/nginx/nginx-plus-ingress${{ contains(inputs.nap_modules, 'dos') && '-dos' || '' }}${{ contains(inputs.nap_modules, 'waf') && '-nap' || '' }},enable=${{ startsWith(github.ref, 'refs/tags/') && contains(inputs.target, 'aws') }}
name=gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/release/nginx-ic${{ contains(inputs.nap_modules, 'dos') && '-dos' || '' }}${{ contains(inputs.nap_modules, 'waf') && '-nap' || '' }}/nginx-plus-ingress,enable=${{ github.ref_type == 'tag' }}
name=709825985650.dkr.ecr.us-east-1.amazonaws.com/nginx/nginx-plus-ingress${{ contains(inputs.nap_modules, 'dos') && '-dos' || '' }}${{ contains(inputs.nap_modules, 'waf') && '-nap' || '' }},enable=${{ github.ref_type == 'tag' && contains(inputs.target, 'aws') }}
flavor: |
suffix=${{ contains(inputs.image, 'ubi') && '-ubi' || '' }}${{ contains(inputs.image, 'alpine') && '-alpine' || '' }}${{ contains(inputs.target, 'aws') && '-mktpl' || '' }}${{ contains(inputs.image, 'fips') && '-fips' || ''}},onlatest=true
latest=${{ contains(inputs.target, 'aws') && 'false' || 'auto' }}
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
provenance: false
build-args: |
BUILD_OS=${{ inputs.image }}
IC_VERSION=${{ startsWith(github.ref, 'refs/tags/') && steps.meta.outputs.version || 'CI' }}
IC_VERSION=${{ github.ref_type == 'tag' && steps.meta.outputs.version || 'CI' }}
${{ inputs.nap_modules != '' && format('NAP_MODULES={0}', inputs.nap_modules) || '' }}
${{ steps.nap_modules.outputs.modules != '' && format('NAP_MODULES_AWS={0}', steps.nap_modules.outputs.modules) || '' }}
secrets: |
Expand All @@ -156,7 +156,7 @@ jobs:
echo "version=$version" >> $GITHUB_OUTPUT
echo "product_code=AWS${nap}_PRODUCT_ID" >> $GITHUB_OUTPUT
echo "registry=${aws_registry}" >> $GITHUB_OUTPUT
if: startsWith(github.ref, 'refs/tags/') && contains(inputs.target, 'aws')
if: github.ref_type == 'tag' && contains(inputs.target, 'aws')

- name: Publish to AWS Marketplace
uses: nginxinc/aws-marketplace-publish@93e03c5ce4baa842a8e5baad0a3f35d07b38460c # v0.1.2
Expand All @@ -173,7 +173,7 @@ jobs:
This container requires Kubernetes and can be deployed to EKS.
Review the installation instructions https://docs.nginx.com/nginx-ingress-controller/installation/ and utilize the deployment resources available https://github.com/nginxinc/kubernetes-ingress/tree/master/deployments
Use this image instead of building your own.
if: ${{ startsWith(github.ref, 'refs/tags/') && contains(inputs.target, 'aws') }}
if: ${{ github.ref_type == 'tag' && contains(inputs.target, 'aws') }}

- name: Load image for Trivy
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
Expand All @@ -186,7 +186,7 @@ jobs:
load: true
build-args: |
BUILD_OS=${{ inputs.image }}
IC_VERSION=${{ startsWith(github.ref, 'refs/tags/') && steps.meta.outputs.version || 'CI' }}
IC_VERSION=${{ github.ref_type == 'tag' && steps.meta.outputs.version || 'CI' }}
${{ inputs.nap_modules != '' && format('NAP_MODULES={0}', inputs.nap_modules) || '' }}
${{ steps.nap_modules.outputs.modules != '' && format('NAP_MODULES_AWS={0}', steps.nap_modules.outputs.modules) || '' }}
secrets: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
with:
minor-label: "enhancement"
major-label: "change"
publish: ${{ startsWith(github.ref, 'refs/tags/') }}
publish: ${{ github.ref_type == 'tag' }}
collapse-after: 50
variables: |
helm-chart=${{ needs.checks.outputs.chart_version }}
Expand All @@ -134,7 +134,7 @@ jobs:
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
with:
version: latest
args: ${{ startsWith(github.ref, 'refs/tags/') && 'release' || 'build --snapshot' }} ${{ github.event_name == 'pull_request' && '--single-target' || '' }} --clean
args: ${{ github.ref_type == 'tag' && 'release' || 'build --snapshot' }} ${{ github.event_name == 'pull_request' && '--single-target' || '' }} --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: ${{ needs.checks.outputs.go_path }}
Expand Down Expand Up @@ -418,7 +418,7 @@ jobs:
- name: Package
id: package
run: |
output=$(helm package ${{ ! startsWith(github.ref, 'refs/tags/') && '--app-version edge --version 0.0.0-edge' || '' }} kic/deployments/helm-chart)
output=$(helm package ${{ github.ref_type != 'tag' && '--app-version edge --version 0.0.0-edge' || '' }} kic/deployments/helm-chart)
echo "path=$(basename -- $(echo $output | cut -d: -f2))" >> $GITHUB_OUTPUT
- name: Push to OCI registries
Expand All @@ -433,7 +433,7 @@ jobs:
fetch-depth: 1
token: ${{ secrets.NGINX_PAT }}
path: helm-charts
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: github.ref_type == 'tag'

- name: Push Helm Chart to Helm Charts Repository
run: |
Expand All @@ -444,4 +444,4 @@ jobs:
git -c user.name='NGINX Kubernetes Team' -c user.email='kubernetes@nginx.com' \
commit -m "NGINX Ingress Controller - Release ${{ needs.checks.outputs.chart_version }}"
git push -u origin master
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: github.ref_type == 'tag'
1 change: 1 addition & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ jobs:
- uses: actions/labeler@4f052778de9a9b80cb16cfb9079b02287285a4cb # v5.0.0-alpha.1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
5 changes: 3 additions & 2 deletions .github/workflows/update-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ jobs:
- name: Set other variables
id: vars
run: |
echo "k8s_version=$(grep -m1 'FROM kindest/node' <tests/Dockerfile | awk -F'[:v]' '{print $3}')" >> $GITHUB_OUTPUT
# TODO fix test folder after v3.3.0
echo "k8s_version=$(grep -m1 'FROM kindest/node' <tests/docker/Dockerfile | awk -F'[:v]' '{print $3}')" >> $GITHUB_OUTPUT
check:
name: Check if updates are needed
Expand Down Expand Up @@ -109,7 +110,7 @@ jobs:
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
with:
version: latest
args: build --rm-dist --id kubernetes-ingress
args: build --clean --id kubernetes-ingress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPATH: ${{ steps.go.outputs.go_path }}
Expand Down

0 comments on commit 7122954

Please sign in to comment.