Skip to content

Commit

Permalink
chore(project): initialize fork (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbaehler authored Nov 2, 2023
1 parent 3cdf4fe commit 05b6c36
Show file tree
Hide file tree
Showing 56 changed files with 1,467 additions and 501 deletions.
14 changes: 14 additions & 0 deletions .github/configs/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Reference: https://github.com/helm/chart-testing/blob/master/doc/ct_lint-and-install.md
##
remote: origin
target-branch: master
chart-dirs:
- helm/
chart-repos:
- buttahtoast=https://buttahtoast.github.io/helm-charts/
- bitnami=https://charts.bitnami.com/bitnami
validate-chart-schema: true
validate-maintainers: false
validate-yaml: true
exclude-deprecated: true
check-version-increment: false
42 changes: 42 additions & 0 deletions .github/configs/lintconf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
rules:
braces:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
max-spaces-before: 0
max-spaces-after: 1
commas:
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments:
require-starting-space: true
min-spaces-from-content: 1
document-end: disable
document-start: disable # No --- to start a file
empty-lines:
max: 2
max-start: 0
max-end: 0
hyphens:
max-spaces-after: 1
indentation:
spaces: consistent
indent-sequences: whatever # - list indentation will handle both indentation and without
check-multi-line-strings: false
key-duplicates: enable
line-length: disable # Lines can be any length
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: enable
truthy:
level: warning
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,22 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
rebase-strategy: disabled
commit-message:
prefix: "feat(deps)"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
rebase-strategy: disabled
commit-message:
prefix: "ci(deps)"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: weekly
rebase-strategy: disabled
commit-message:
prefix: "ci(deps)"

20 changes: 20 additions & 0 deletions .github/workflows/check-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check actions
permissions: {}

on:
pull_request:
branches: [ "master", "main" ]

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@f32435541e24cd6a4700a7f52bb2ec59e80603b1 # v2.1.4
with:
# slsa-github-generator requires using a semver tag for reusable workflows.
# See: https://github.com/slsa-framework/slsa-github-generator#referencing-slsa-builders-and-generators
allowlist: |
slsa-framework/slsa-github-generator
21 changes: 21 additions & 0 deletions .github/workflows/check-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Commit
permissions: {}

on:
pull_request:
branches: [ "*" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
commit_lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@6319f54d83768b60acd6fd60e61007ccc583e62f #v5.4.3
with:
firstParent: true
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,33 @@ on:
pull_request:
branches:
- "master"
- "main"
push:
branches:
- "master"
- "main"

permissions: read-all

jobs:
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Check secret
id: checksecret
uses: peak-scale/github-actions/exists@8dfd42735c85f6c58d5d4d6f3232cd0e39d1fe73 # v0.1.0
with:
value: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.19'
- name: Run integration tests
run: |
make integration-test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
if: steps.checksecret.outputs.result == 'true'
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: ./test/integration/cover.out
env:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build images
permissions: {}

on:
pull_request:
branches: [ "master", "main" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-images:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: ko build
run: VERSION=${{ github.ref_name }} REPOSITORY=${GITHUB_REPOSITORY} make docker-build
- name: Trivy Scan Image
uses: aquasecurity/trivy-action@fbd16365eb88e12433951383f5e99bd901fc618f # v0.12.0
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
67 changes: 67 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Publish images
permissions: {}
on:
push:
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-images:
runs-on: ubuntu-latest
permissions:
packages: write
id-token: write
outputs:
container-digest: ${{ steps.publish.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: "Extract Version"
id: extract_version
run: |
GIT_TAG=${GITHUB_REF##*/}
VERSION=${GIT_TAG##v}
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
- name: Run Trivy vulnerability (Repo)
uses: aquasecurity/trivy-action@fbd16365eb88e12433951383f5e99bd901fc618f # v0.12.0
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
- name: Install Cosign
uses: sigstore/cosign-installer@11086d25041f77fe8fe7b9ea4e48e3b9192b8f19 # v3.1.2
- name: Publish with KO
id: publish
uses: peak-scale/github-actions/make-ko-publish@38322faabccd75abfa581c435e367d446b6d2c3b # v0.1.0
with:
makefile-target: docker-publish
registry: ghcr.io
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository_owner }}
version: ${{ steps.extract_version.outputs.version }}
sign-image: true
sbom-name: cloudflare-tunnel-ingress-controller
sbom-repository: ghcr.io/${{ github.repository_owner }}/sbom
signature-repository: ghcr.io/${{ github.repository_owner }}/signatures
main-path: ./cmd/cloudflare-tunnel-ingress-controller/
env:
REPOSITORY: ${{ github.repository }}
VERSION: ${{ steps.extract_version.outputs.version }}
generate-provenance:
needs: publish-images
permissions:
id-token: write # To sign the provenance.
packages: write # To upload assets to release.
actions: read # To read the workflow path.
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
image: ghcr.io/${{ github.repository_owner }}/cloudflare-tunnel-ingress-controller
digest: "${{ needs.publish-images.outputs.container-digest }}"
registry-username: ${{ github.actor }}
secrets:
registry-password: ${{ secrets.GITHUB_TOKEN }}
21 changes: 0 additions & 21 deletions .github/workflows/helm-package-test.yaml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/helm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish charts
permissions: read-all
on:
push:
tags:
- "v*"
jobs:
publish-helm:
runs-on: ubuntu-20.04
permissions:
contents: write
id-token: write
packages: write
outputs:
chart-digest: ${{ steps.helm_publish.outputs.digest }}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: sigstore/cosign-installer@11086d25041f77fe8fe7b9ea4e48e3b9192b8f19 # v3.1.2
- name: "Extract Version"
id: extract_version
run: |
GIT_TAG=${GITHUB_REF##*/}
VERSION=${GIT_TAG##v}
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
- name: Helm | Publish
id: helm_publish
uses: peak-scale/github-actions/helm-oci-chart@38322faabccd75abfa581c435e367d446b6d2c3b
with:
registry: ghcr.io
repository: ${{ github.repository_owner }}/charts
name: "cloudflare-tunnel-ingress-controller"
path: "./charts/cloudflare-tunnel-ingress-controller/"
app-version: ${{ steps.extract_version.outputs.version }}
version: ${{ steps.extract_version.outputs.version }}
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
update-dependencies: 'true' # Defaults to false
sign-image: 'true'
signature-repository: ghcr.io/${{ github.repository_owner }}/signatures
helm-provenance:
needs: publish-helm
permissions:
id-token: write # To sign the provenance.
packages: write # To upload assets to release.
actions: read # To read the workflow path.
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
image: ghcr.io/${{ github.repository_owner }}/charts/cloudflare-tunnel-ingress-controller
digest: "${{ needs.publish-helm.outputs.chart-digest }}"
registry-username: ${{ github.actor }}
secrets:
registry-password: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/helm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test charts
permissions: {}

on:
pull_request:
branches: [ "master", "main" ]

jobs:
lint:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0
- uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
- name: Setup Chart Linting
id: lint
uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .github/configs/ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --debug --config .github/configs/ct.yaml --lint-conf .github/configs/lintconf.yaml
- name: Run docs-testing (helm-docs)
id: helm-docs
run: |
make helm-docs
if [[ $(git diff --stat) != '' ]]; then
echo -e '\033[0;31mDocumentation outdated! (Run make helm-docs locally and commit)\033[0m ❌'
git diff --color
exit 1
else
echo -e '\033[0;32mDocumentation up to date\033[0m ✔'
fi
## Create KIND Cluster
- name: Create kind cluster
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
if: steps.list-changed.outputs.changed == 'true'

# Install Charts
- name: Run chart-testing (install)
run: ct install --debug --config .github/configs/ct.yaml
if: steps.list-changed.outputs.changed == 'true'
Loading

0 comments on commit 05b6c36

Please sign in to comment.