-
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.
Merge branch 'main' into paginate-ghcr
- Loading branch information
Showing
38 changed files
with
1,544 additions
and
676 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,52 @@ | ||
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 | ||
|
||
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,146 @@ | ||
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: Fid 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: Commit files | ||
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 | ||
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 |
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,38 @@ | ||
# (mandatory) | ||
# Path to coverprofile file (output of `go test -coverprofile` command) | ||
profile: coverage.out | ||
|
||
# (optional) | ||
# When specified reported file paths will not contain local prefix in the output | ||
# local-prefix: "github.com/org/project" | ||
|
||
# Holds coverage thresholds percentages, values should be in range [0-100] | ||
threshold: | ||
# (optional; default 0) | ||
# The minimum coverage that each file should have | ||
file: 0 | ||
|
||
# (optional; default 0) | ||
# The minimum coverage that each package should have | ||
package: 0 | ||
|
||
# (optional; default 0) | ||
# The minimum total coverage project should have | ||
total: 0 | ||
|
||
# Holds regexp rules which will override thresholds for matched files or packages | ||
# override: | ||
# # Increase coverage threshold to 100% for `foo` package (default is 80, as configured above) | ||
# - threshold: 100 | ||
# path: ^pkg/lib/foo$ | ||
|
||
# Holds regexp rules which will exclude matched files or packages from coverage statistics | ||
# exclude: | ||
# # Exclude files or packages matching their paths | ||
# paths: | ||
# - \.pb\.go$ # excludes all protobuf generated files | ||
# - ^pkg/bar # exclude package `pkg/bar` | ||
|
||
# NOTES: | ||
# - symbol `/` in all path regexps will be replaced by | ||
# current OS file path separator to properly work on Windows |
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,8 +1,18 @@ | ||
FROM alpine:3.12 | ||
FROM golang:1.20-alpine as builder | ||
|
||
RUN apk --no-cache add make | ||
|
||
COPY . /app/ | ||
WORKDIR /app/ | ||
|
||
RUN make build | ||
|
||
|
||
FROM alpine:3.18.3 | ||
LABEL description="Kubernetes utility for exposing used image versions compared to the latest version, as metrics." | ||
|
||
RUN apk --no-cache add ca-certificates | ||
|
||
COPY ./bin/version-checker-linux /usr/bin/version-checker | ||
COPY --from=builder /app/bin/version-checker /usr/bin/version-checker | ||
|
||
ENTRYPOINT ["/usr/bin/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
Oops, something went wrong.