Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push edge Helm Chart to OCI registries #3581

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:

- name: Docker Buildx
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1

- name: DockerHub Login
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
Expand Down
90 changes: 45 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ defaults:
run:
shell: bash

env:
HELM_CHART_DIR: deployments/helm-chart
GIT_NAME: NGINX Kubernetes Team
GIT_MAIL: [email protected]

concurrency:
group: ${{ github.ref_name }}-ci
cancel-in-progress: true
Expand Down Expand Up @@ -342,62 +337,67 @@ jobs:
path: ${{ github.workspace }}/tests/${{ steps.smoke-tests.outputs.test-results-name }}.html
if: always()

package-helm:
name: Package Helm Chart
publish-helm:
name: Package and Publish Helm Chart
runs-on: ubuntu-22.04
needs: unit-tests
outputs:
version: ${{ steps.var.outputs.helm_version }}
type: ${{ steps.var.outputs.helm_type }}
needs: helm-tests
if: ${{ github.event_name == 'push' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Output Variables
id: var
run: |
if ${{ startsWith(github.ref, 'refs/tags/') }}; then
helm_version="$(helm show chart ${{ env.HELM_CHART_DIR }} | grep 'version:' | cut -d ' ' -f 2)"
helm_type="stable"
else
helm_version="0.0.0-edge"
helm_type="edge"
fi
echo "helm_version=$helm_version" >> $GITHUB_OUTPUT
echo "helm_type=$helm_type" >> $GITHUB_OUTPUT
- name: Lint
run: helm lint ${{ env.HELM_CHART_DIR }}
- name: Package
run: helm package --version ${{ steps.var.outputs.helm_version }} ${{ env.HELM_CHART_DIR }}
- name: Upload Chart
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: helm-chart
path: ${{ github.workspace }}/nginx-ingress-${{ steps.var.outputs.helm_version }}.tgz
path: kic

- name: Login to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: DockerHub Login
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- 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)
echo "path=$(basename -- $(echo $output | cut -d: -f2))" >> $GITHUB_OUTPUT

- name: Push to OCI registries
run: |
helm push ${{ steps.package.outputs.path }} oci://ghcr.io/nginxinc/charts
helm push ${{ steps.package.outputs.path }} oci://registry-1.docker.io/nginxcharts

release-helm:
name: Release Helm Chart
runs-on: ubuntu-22.04
needs: package-helm
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout Repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
repository: nginxinc/helm-charts
fetch-depth: 1
token: ${{ secrets.NGINX_PAT }}
path: helm-charts

- name: Get Chart type
id: package-helm
run: |
echo "type=${{ contains(steps.package.outputs.path, 'edge') && 'edge' || 'stable' }}" >> $GITHUB_OUTPUT

- name: Remove previous Chart
run: rm -f ${{ github.workspace }}/${{ needs.package-helm.outputs.type }}/nginx-ingress-${{ needs.package-helm.outputs.version }}.tgz
- name: Retrieve latest Helm Chart
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: helm-chart
path: ${{ github.workspace }}/${{ needs.package-helm.outputs.type }}
- name: Push Helm Chart
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
run: rm -f ${{ github.workspace }}/helm-charts/edge/nginx-ingress-0.0.0-edge.tgz

- name: Push Helm Chart to Helm Charts Repository
run: |
mv ${{ steps.package.outputs.path }} ${{ github.workspace }}/helm-charts/${{ steps.package-helm.outputs.type }}/
cd ${{ github.workspace }}/helm-charts
helm repo index ${{ needs.package-helm.outputs.type }} --url https://helm.nginx.com/${{ needs.package-helm.outputs.type }}
git add -A
git -c user.name='${{ env.GIT_NAME }}' -c user.email='${{ env.GIT_MAIL }}' \
git -c user.name='NGINX Kubernetes Team' -c user.email='[email protected]' \
commit -m "NGINX Ingress Controller - Release ${{ needs.package-helm.outputs.type }} ${{ needs.package-helm.outputs.version }}"
git push -u origin master
9 changes: 9 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,12 @@ jobs:
- uses: reviewdog/action-actionlint@b6feb003955cad286985c42e7047f4567a798f3f # v1.36.0
with:
actionlint_flags: -shellcheck ""

chart-lint:
name: Chart Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Lint chart
run: helm lint deployments/helm-chart
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ We publish Ingress Controller releases on GitHub. See our [releases page](https:

The latest stable release is [3.0.2](https://github.com/nginxinc/kubernetes-ingress/releases/tag/v3.0.2). For production use, we recommend that you choose the latest stable release.

The edge version is useful for experimenting with new features that are not yet published in a stable release. To use, choose the *edge* version built from the [latest commit](https://github.com/nginxinc/kubernetes-ingress/commits/main) from the main branch.
The edge version is useful for experimenting with new features that are not yet published in a stable release. To use it, choose the *edge* version built from the [latest commit](https://github.com/nginxinc/kubernetes-ingress/commits/main) from the main branch.

To use the Ingress Controller, you need to have access to:
* An Ingress Controller image.
Expand Down
Loading