-
Notifications
You must be signed in to change notification settings - Fork 80
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
52 changed files
with
2,557 additions
and
735 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 @@ | ||
* @davidcollom |
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,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 0 | ||
|
||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 0 |
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,89 @@ | ||
name: Test & Build | ||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests | ||
name: Lint Go code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
- name: Setup Golang | ||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.0 | ||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0 | ||
with: | ||
version: v1.53 | ||
args: --timeout 10m --exclude SA5011 --verbose --issues-exit-code=0 | ||
only-new-issues: true | ||
|
||
test: | ||
name: Run unit tests for Go packages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 # v3.5.3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Download and required packages | ||
run: | | ||
make deps | ||
- name: Run all unit tests | ||
run: make test | ||
|
||
- name: check test coverage | ||
uses: vladopajic/go-test-coverage@v2 | ||
with: | ||
config: ./.testcoverage.yml | ||
|
||
- name: Generate code coverage artifacts | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: code-coverage | ||
path: coverage.out | ||
|
||
build: | ||
needs: | ||
- test | ||
- lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64 | ||
- linux/arm/v7 | ||
name: Build Images | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: ${{ matrix.platform }} | ||
|
||
- name: Build Images | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.platform }} | ||
push: false | ||
tags: quay.io/jetstack/version-checker:${{github.sha}} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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,104 @@ | ||
name: Test Helm Chart | ||
on: | ||
pull_request: | ||
paths: | ||
- '!*.md' | ||
- 'deploy/charts/version-checker/**' | ||
branches: | ||
- 'main' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests | ||
name: Lint Helm Chart | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
||
- uses: azure/setup-helm@v3 | ||
|
||
- run: helm lint deploy/charts/version-checker | ||
|
||
docs: | ||
name: Generate Helm Docs | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- name: Check for values.yaml changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
values: | ||
- 'deploy/charts/version-checker/values.yaml' | ||
- 'deploy/charts/version-checker/Chart.yaml' | ||
- name: Install Helm Docs | ||
if: steps.filter.outputs.values == 'true' | ||
uses: envoy/[email protected] | ||
with: | ||
version: 1.11.0 | ||
- name: Update Helm Docs | ||
if: steps.filter.outputs.values == 'true' | ||
run: | | ||
set -ex | ||
cd deploy/charts/version-checker | ||
helm-docs | ||
- name: Check for README.md changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter-readme | ||
with: | ||
base: HEAD | ||
filters: | | ||
readme: | ||
- 'deploy/charts/version-checker/README.md' | ||
- name: Commit Helm Docs | ||
if: steps.filter-readme.outputs.readme == 'true' | ||
run: | | ||
set -ex | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add deploy/charts/version-checker | ||
git commit -m "[HELM] Update helm docs" | ||
- name: Push Changes | ||
if: steps.filter-readme.outputs.readme == 'true' | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.head_ref }} | ||
|
||
|
||
test: | ||
name: Run unit tests for Helm Chart | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
||
- uses: azure/setup-helm@v3 | ||
with: | ||
token: ${{ github.token }} | ||
|
||
- name: Install helm Plugins | ||
run: | | ||
if [ ! -e "${HELM_PLUGINS}/helm-unittest" ]; then | ||
helm plugin install https://github.com/helm-unittest/helm-unittest.git | ||
fi | ||
- name: Run Tests | ||
run: | | ||
if [ ! -e "deploy/charts/version-checker/tests" ]; then | ||
echo "Not running tests, directory doesn't exist: deploy/charts/version-checker/tests" | ||
exit 0 | ||
fi | ||
helm unittest deploy/charts/version-checker |
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,160 @@ | ||
name: Version-Checker Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- "release-v*" | ||
tags: | ||
- "*" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
update-version-files: | ||
# Don't push back to a tag! | ||
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
name: Update Version Numbers | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: bhowell2/[email protected] | ||
id: release_number | ||
with: | ||
value: ${{github.ref_name}} | ||
index_of_str: "release-" | ||
|
||
- name: Find and Replace Helm Chart Version | ||
uses: jacobtomlinson/gha-find-replace@v3 | ||
with: | ||
find: 'v(\d+)\.(\d+)\.(\d+)(-rc(\d)+)?' | ||
replace: "${{steps.release_number.outputs.substring}}" | ||
include: "deploy/charts/version-checker/Chart.yaml" | ||
regex: true | ||
- name: Find and Replace Kubernetes Manifests | ||
uses: jacobtomlinson/gha-find-replace@v3 | ||
with: | ||
find: 'v(\d+)\.(\d+)\.(\d+)(-rc(\d)+)?' | ||
replace: "${{steps.release_number.outputs.substring}}" | ||
include: "deploy/yaml/deploy.yaml" | ||
regex: true | ||
- name: Find and Replace Makefile versions | ||
uses: jacobtomlinson/gha-find-replace@v3 | ||
with: | ||
find: 'v(\d+)\.(\d+)\.(\d+)(-rc(\d)+)?' | ||
replace: "${{steps.release_number.outputs.substring}}" | ||
include: "Makefile" | ||
regex: true | ||
|
||
- name: Detect any Local Changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
base: HEAD | ||
filters: | | ||
versions: | ||
- 'Makefile' | ||
- 'deploy/yaml/deploy.yaml' | ||
- 'deploy/charts/version-checker/Chart.yaml' | ||
- name: Commit files | ||
if: steps.filter.outputs.versions == 'true' | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git status | ||
git commit -a -m "Bump versions to ${{steps.release_number.outputs.substring}} " | ||
- name: Push changes | ||
if: steps.filter.outputs.versions == 'true' | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref_name }} | ||
|
||
helm-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout our Repo | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: version-checker | ||
|
||
- name: checkout jetstack-charts | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.JETSTACK_CHARTS_PAT }} | ||
repository: jetstack/jetstack-charts | ||
ref: main | ||
path: jetstack-charts | ||
|
||
- uses: azure/setup-helm@v3 | ||
with: | ||
token: ${{ github.token }} | ||
|
||
- name: package helm chart | ||
run: | | ||
helm package version-checker/deploy/charts/version-checker -d jetstack-charts/charts/ | ||
- name: Creating PR | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.JETSTACK_CHARTS_PAT }} | ||
title: "Release version-checker ${{github.ref_name }}" | ||
commit-message: "Release version-checker ${{github.ref_name }}" | ||
branch: version-checker/${{github.ref_name}} | ||
path: jetstack-charts | ||
add-paths: charts/*.tgz | ||
delete-branch: true | ||
signoff: true | ||
base: main | ||
draft: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
|
||
docker-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: ${{ matrix.platform }} | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | ||
|
||
- name: Build and push (if applicable) | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
push: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
pull: true | ||
tags: quay.io/jetstack/version-checker:${{github.ref_name}} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
github-release: | ||
name: Create/Update GitHub Release | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Create Release / Change Logs | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
prerelease: ${{ contains('-rc', github.ref_name) || !startsWith(github.ref, 'refs/tags/') }} | ||
generate_release_notes: true |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
/bin | ||
coverage.out |
Oops, something went wrong.