Skip to content

Commit 2ae4a4e

Browse files
committed
initial revision
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
0 parents  commit 2ae4a4e

30 files changed

+1433
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/kube-janitor
2+
/release-assets

.editorconfig

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
end_of_line = lf
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 4
13+
14+
[Makefile]
15+
indent_style = tab
16+
17+
[{*.yml,*.yaml}]
18+
indent_size = 2
19+
20+
[*.conf]
21+
indent_size = 2
22+
23+
[*.go]
24+
indent_size = 4
25+
indent_style = tab
26+
ij_continuation_indent_size = 4
27+
ij_go_GROUP_CURRENT_PROJECT_IMPORTS = true
28+
ij_go_add_leading_space_to_comments = true
29+
ij_go_add_parentheses_for_single_import = true
30+
ij_go_call_parameters_new_line_after_left_paren = true
31+
ij_go_call_parameters_right_paren_on_new_line = true
32+
ij_go_call_parameters_wrap = off
33+
ij_go_fill_paragraph_width = 80
34+
ij_go_group_stdlib_imports = true
35+
ij_go_import_sorting = goimports
36+
ij_go_keep_indents_on_empty_lines = false
37+
ij_go_local_group_mode = project
38+
ij_go_move_all_imports_in_one_declaration = true
39+
ij_go_move_all_stdlib_imports_in_one_group = true
40+
ij_go_remove_redundant_import_aliases = false
41+
ij_go_run_go_fmt_on_reformat = true
42+
ij_go_use_back_quotes_for_imports = false
43+
ij_go_wrap_comp_lit = off
44+
ij_go_wrap_comp_lit_newline_after_lbrace = true
45+
ij_go_wrap_comp_lit_newline_before_rbrace = true
46+
ij_go_wrap_func_params = off
47+
ij_go_wrap_func_params_newline_after_lparen = true
48+
ij_go_wrap_func_params_newline_before_rparen = true
49+
ij_go_wrap_func_result = off
50+
ij_go_wrap_func_result_newline_after_lparen = true
51+
ij_go_wrap_func_result_newline_before_rparen = true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Setup-Go'
2+
description: 'Setup go with dependencies'
3+
runs:
4+
using: composite
5+
steps:
6+
7+
- uses: actions/setup-go@v6
8+
with:
9+
go-version-file: 'go.mod'
10+
cache-dependency-path: "go.sum"
11+
check-latest: true
12+
13+
- name: GoLang dependencies
14+
shell: bash
15+
run: |
16+
go mod vendor
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Setup-Runner'
2+
description: 'Setup runner'
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Set Swap Space
7+
uses: pierotofy/set-swap-space@fc79b3f67fa8a838184ce84a674ca12238d2c761
8+
with:
9+
swap-size-gb: 12

.github/dependabot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
all-github-actions:
9+
patterns: [ "*" ]
10+
11+
- package-ecosystem: "docker"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
15+
groups:
16+
all-docker-versions:
17+
patterns: [ "*" ]
18+
19+
- package-ecosystem: "gomod"
20+
directory: "/"
21+
schedule:
22+
interval: "weekly"
23+
groups:
24+
all-go-mod-patch-and-minor:
25+
patterns: [ "*" ]
26+
update-types: [ "patch", "minor" ]
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: build/docker
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
publish:
7+
required: true
8+
type: boolean
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v5
15+
16+
- name: Setup runner
17+
uses: ./.github/actions/setup-runner
18+
19+
- name: Setup go
20+
uses: ./.github/actions/setup-go
21+
22+
- name: Run Golangci lint
23+
uses: golangci/golangci-lint-action@v9
24+
with:
25+
version: latest
26+
args: --print-resources-usage
27+
28+
build:
29+
name: "build ${{ matrix.Dockerfile }}:${{ matrix.target }}"
30+
needs: lint
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- Dockerfile: Dockerfile
36+
target: "final"
37+
suffix: ""
38+
latest: "auto"
39+
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v5
43+
44+
- name: Setup runner
45+
uses: ./.github/actions/setup-runner
46+
47+
- name: Setup go
48+
uses: ./.github/actions/setup-go
49+
50+
- name: Docker meta
51+
id: docker_meta
52+
uses: docker/metadata-action@v5
53+
with:
54+
images: |
55+
${{ github.repository }}
56+
quay.io/${{ github.repository }}
57+
labels: |
58+
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
59+
flavor: |
60+
latest=${{ matrix.latest }}
61+
suffix=${{ matrix.suffix }}
62+
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v3
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Login to DockerHub
70+
uses: docker/login-action@v3
71+
if: ${{ inputs.publish }}
72+
with:
73+
username: ${{ secrets.DOCKERHUB_USERNAME }}
74+
password: ${{ secrets.DOCKERHUB_TOKEN }}
75+
76+
- name: Login to Quay
77+
uses: docker/login-action@v3
78+
if: ${{ inputs.publish }}
79+
with:
80+
registry: quay.io
81+
username: ${{ secrets.QUAY_USERNAME }}
82+
password: ${{ secrets.QUAY_TOKEN }}
83+
84+
- name: ${{ inputs.publish && 'Build and push' || 'Build' }}
85+
uses: docker/build-push-action@v6
86+
with:
87+
context: .
88+
file: ./${{ matrix.Dockerfile }}
89+
target: ${{ matrix.target }}
90+
platforms: linux/amd64,linux/arm64
91+
push: ${{ inputs.publish }}
92+
tags: ${{ steps.docker_meta.outputs.tags }}
93+
labels: ${{ steps.docker_meta.outputs.labels }}
94+
cache-from: type=gha
95+
cache-to: type=gha,mode=max

.github/workflows/ci-docker.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "ci/docker"
2+
3+
on: [pull_request, workflow_dispatch]
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
build:
11+
uses: ./.github/workflows/build-docker.yaml
12+
secrets: inherit
13+
with:
14+
publish: false
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "release/assets"
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
env:
12+
RELEASE_TAG: ${{ github.ref_name }}
13+
14+
jobs:
15+
build:
16+
name: "${{ matrix.task }}"
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- task: release-assets-linux
23+
- task: release-assets-darwin
24+
- task: release-assets-windows
25+
steps:
26+
- uses: actions/checkout@v5
27+
28+
- name: Setup runner
29+
uses: ./.github/actions/setup-runner
30+
31+
- name: Setup go
32+
uses: ./.github/actions/setup-go
33+
34+
- name: Build
35+
run: |
36+
make "${{ matrix.task }}"
37+
38+
- name: Upload assets to release
39+
uses: svenstaro/upload-release-action@v2
40+
with:
41+
repo_token: ${{ secrets.GITHUB_TOKEN }}
42+
file: ./release-assets/*
43+
tag: ${{ github.ref }}
44+
overwrite: true
45+
file_glob: true
46+
promote: false
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "release/docker"
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
branches:
7+
- 'main'
8+
- 'feature-**'
9+
- 'bugfix-**'
10+
tags:
11+
- '*.*.*'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
release:
19+
uses: ./.github/workflows/build-docker.yaml
20+
secrets: inherit
21+
with:
22+
publish: ${{ github.event_name != 'pull_request' }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "schedule/docker"
2+
3+
on:
4+
schedule:
5+
- cron: '45 6 * * 1'
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
schedule:
13+
uses: ./.github/workflows/build-docker.yaml
14+
secrets: inherit
15+
with:
16+
publish: true

0 commit comments

Comments
 (0)