-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
810 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
name: Build and Test Container Image | ||
on: | ||
release: | ||
types: | ||
- published | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
file-changes: | ||
name: Gather File Changes | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
chart: ${{ steps.changes.outputs.chart }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Gather File Changes | ||
uses: dorny/paths-filter@v2 | ||
id: changes | ||
with: | ||
list-files: none | ||
filters: | | ||
chart: | ||
- chart/** | ||
build-image: | ||
name: Build Image | ||
needs: | ||
- file-changes | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Assemble Metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
# We want to set the following tags: | ||
# - `main` if executed for build on main branch | ||
# - SemVer when running for a release | ||
tags: | | ||
type=ref,enable=${{ github.ref_name == 'main' }},event=branch | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
# Only push when building for a tag or the main branch | ||
if: github.ref_type == 'tag' || (github.ref_type == 'branch' && github.ref_name == 'main') | ||
- name: Build Multi-Platform Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
# Only push when building for a tag or the main branch | ||
push: | ||
${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && github.ref_name == | ||
'main') }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
# Only export and upload the image if used for testing | ||
- name: Export Image for Test Platform | ||
if: needs.file-changes.outputs.chart == 'true' && github.ref_type != 'tag' | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: false | ||
outputs: type=oci,dest=/tmp/image.tar | ||
- name: Upload Image for Testing | ||
uses: actions/upload-artifact@v2 | ||
if: needs.file-changes.outputs.chart == 'true' && github.ref_type != 'tag' | ||
with: | ||
name: docker-image | ||
path: /tmp/image.tar | ||
|
||
e2e-tests: | ||
name: Test Helm Chart | ||
needs: | ||
- file-changes | ||
- build-image | ||
runs-on: ubuntu-20.04 | ||
if: needs.file-changes.outputs.chart == 'true' && github.ref_type != 'tag' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Set up Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "16" | ||
- name: Install Bats | ||
run: npm install -g [email protected] | ||
shell: bash | ||
- name: Download Image for Testing | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: docker-image | ||
path: /tmp | ||
- name: Setup Kubernetes Cluster | ||
uses: container-tools/[email protected] | ||
with: | ||
config: chart/tests/kind/actions.yaml | ||
- name: Load Docker Image | ||
run: | | ||
docker load -i /tmp/image.tar | ||
docker image ls | ||
IMAGE_ID=$(docker load -i /tmp/image.tar | rev | cut -d' ' -f1 | rev) | ||
docker tag $IMAGE_ID $KIND_REGISTRY/switchboard:dev | ||
docker push $KIND_REGISTRY/switchboard:dev | ||
- name: Specify Image Tag | ||
uses: mikefarah/[email protected] | ||
with: | ||
cmd: | | ||
yq -i ' | ||
.image.name = "${{ env.KIND_REGISTRY }}/switchboard" | | ||
.image.tag = "dev" | ||
' chart/tests/values/base.yaml | ||
- name: Run Tests | ||
run: bats ./tests -t | ||
working-directory: ./chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Check Helm Chart | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- chart/** | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- chart/** | ||
|
||
jobs: | ||
lint: | ||
name: Run Linting | ||
runs-on: ubuntu-20.04 | ||
container: alpine/helm:3.8.2 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Lint Chart | ||
run: helm lint | ||
working-directory: ./chart | ||
|
||
check-docs: | ||
name: Check Docs | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ">=1.18.0" | ||
- name: Download helm-docs | ||
run: go install github.com/norwoodj/helm-docs/cmd/[email protected] | ||
- name: Generate README | ||
run: helm-docs | ||
working-directory: ./chart | ||
- name: Check for changes | ||
run: helm-docs -o README.tmp.md && diff README.md README.tmp.md | ||
working-directory: ./chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish Helm Chart | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
publish: | ||
name: Package and Upload | ||
runs-on: ubuntu-20.04 | ||
container: alpine/helm:3.8.2 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Login to GitHub OCI Registry | ||
run: | | ||
echo ${{ github.token }} | \ | ||
helm registry login ghcr.io --username ${{ github.actor }} --password-stdin | ||
- name: Install yq | ||
run: apk add yq | ||
- name: Download Dependencies | ||
run: helm dependency build | ||
- name: Package Chart | ||
run: | | ||
VERSION=${{ github.ref_name }} | ||
helm package . \ | ||
--app-version ${VERSION#v} \ | ||
--version ${VERSION#v} | ||
working-directory: ./chart | ||
- name: Push Chart | ||
run: | | ||
VERSION=${{ github.ref_name }} | ||
helm push switchboard-${VERSION#v}.tgz oci://ghcr.io/${{ github.actor }}/charts | ||
working-directory: ./chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,8 @@ | |
|
||
# Tests | ||
cover.out | ||
|
||
# Charts | ||
Chart.lock | ||
/chart/charts | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: v2 | ||
type: application | ||
name: switchboard | ||
version: 0.0.0 | ||
appVersion: 0.0.0 | ||
home: https://github.com/borchero/switchboard | ||
sources: | ||
- https://github.com/borchero/switchboard | ||
keywords: | ||
- dns | ||
- tls | ||
- external-dns | ||
- cert-manager | ||
- traefik | ||
- dnsendpoint | ||
|
||
dependencies: | ||
- name: external-dns | ||
version: 6.5.2 | ||
repository: https://charts.bitnami.com/bitnami | ||
condition: external-dns.install | ||
- name: cert-manager | ||
version: 1.8.0 | ||
repository: https://charts.jetstack.io | ||
condition: cert-manager.install |
Oops, something went wrong.