Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 3e25ba0

Browse files
authored
OSS preparation (#10)
* OSS preparation * release workflow * master * order * envtest rollback * badges (some of them temp until approve) * kafka testcontainer probe * remove duplicate line * updated badge id
1 parent f882ccb commit 3e25ba0

37 files changed

+980
-420
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
#### Describe the bug
11+
A clear and concise description of what the bug is.
12+
13+
#### To Reproduce
14+
Steps to reproduce the behavior:
15+
16+
#### Expected behavior
17+
A clear and concise description of what you expected to happen.
18+
19+
#### Environment
20+
- controller version: [e.g. v0.0.1]
21+
- kafka version: [e.g. v2.5.0]
22+
- zookeeper version: [e.g. v5.0.0]
23+
- kubernetes version: [e.g. v1.20.14]
24+
25+
#### Additional context
26+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Change request
3+
about: Propose a change for an already implemented solution
4+
title: ''
5+
labels: change
6+
assignees: ''
7+
8+
---
9+
10+
#### Describe the change
11+
A clear and concise description of what the change is about.
12+
13+
#### Current situation
14+
Describe the current situation.
15+
16+
#### Should
17+
Describe the changes you would like to propose.
18+
19+
#### Additional context
20+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: feature
6+
assignees: ''
7+
8+
---
9+
10+
#### Is your feature request related to a problem? Please describe
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
#### Describe the solution you'd like
14+
A clear and concise description of what you want to happen.
15+
16+
#### Describe alternatives you've considered
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
#### Additional context
20+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Current situation
2+
<!--- Shortly describe the current situation -->
3+
4+
## Proposal
5+
<!--- Describe what this PR is intended to achieve -->

.github/workflows/chart.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Lint and Test Charts
2+
3+
on: pull_request
4+
5+
jobs:
6+
lint-test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Set up Helm
15+
uses: azure/setup-helm@v1
16+
with:
17+
version: v3.4.0
18+
19+
- uses: actions/setup-python@v2
20+
with:
21+
python-version: 3.7
22+
23+
- name: Set up chart-testing
24+
uses: helm/chart-testing-action@v2.1.0
25+
26+
- name: Run chart-testing (list-changed)
27+
id: list-changed
28+
run: |
29+
changed=$(ct list-changed --chart-dirs chart)
30+
if [[ -n "$changed" ]]; then
31+
echo "::set-output name=changed::true"
32+
fi
33+
34+
- name: Run chart-testing (lint)
35+
run: ct lint --chart-dirs chart
36+
37+
- name: Create kind cluster
38+
uses: helm/kind-action@v1.2.0
39+
if: steps.list-changed.outputs.changed == 'true'
40+
41+
- name: Run chart-testing (install)
42+
run: ct install --chart-dirs chart

.github/workflows/e2e.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,36 @@ on:
44
pull_request:
55
push:
66
branches:
7-
- main
7+
- master
88

99
jobs:
1010
kind:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v2
15+
- name: Setup QEMU
16+
uses: docker/setup-qemu-action@v1
17+
with:
18+
platforms: all
19+
- name: Setup Docker Buildx
20+
id: buildx
21+
uses: docker/setup-buildx-action@v1
1522
- name: Restore Go cache
1623
uses: actions/cache@v1
1724
with:
1825
path: ~/go/pkg/mod
1926
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
2027
restore-keys: |
2128
${{ runner.os }}-go-
29+
- name: Cache Docker layers
30+
uses: actions/cache@v2
31+
id: cache
32+
with:
33+
path: /tmp/.buildx-cache
34+
key: ${{ runner.os }}-buildx-ghcache-${{ github.sha }}
35+
restore-keys: |
36+
${{ runner.os }}-buildx-ghcache-
2237
- name: Setup Go
2338
uses: actions/setup-go@v2
2439
with:
@@ -40,14 +55,20 @@ jobs:
4055
run: make test
4156
- name: Check if working tree is dirty
4257
run: |
43-
go version
4458
if [[ $(git diff --stat) != '' ]]; then
4559
git --no-pager diff
4660
echo 'run make test and commit changes'
4761
exit 1
4862
fi
4963
- name: Build container image
50-
run: make docker-build-without-tests IMG=test/k8skafka-controller:latest BUILD_PLATFORMS=linux/amd64 BUILD_ARGS=--load
64+
run: |
65+
make docker-build IMG=test/k8skafka-controller:latest BUILD_PLATFORMS=linux/amd64 \
66+
BUILD_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache \
67+
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max"
68+
- name: Move cache
69+
run: |
70+
rm -rf /tmp/.buildx-cache
71+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
5172
- name: Load test image
5273
run: kind load docker-image test/k8skafka-controller:latest
5374
- name: Deploy controller

.github/workflows/rebase.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: rebase
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
issue_comment:
7+
types: [created]
8+
9+
jobs:
10+
rebase:
11+
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && (github.event.comment.author_association == 'CONTRIBUTOR' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER')
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout the latest code
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
- name: Automatic Rebase
19+
uses: cirrus-actions/rebase@1.3.1
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release Chart
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Configure Git
18+
run: |
19+
git config user.name "$GITHUB_ACTOR"
20+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
21+
- name: Run chart-releaser
22+
uses: helm/chart-releaser-action@v1.3.0
23+
with:
24+
charts_dir: ./chart
25+
env:
26+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/release.yaml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'image tag prefix'
10+
default: 'rc'
11+
required: true
12+
13+
permissions:
14+
contents: write # needed to write releases
15+
id-token: write # needed for keyless signing
16+
packages: write # needed for ghcr access
17+
18+
env:
19+
CONTROLLER: ${{ github.event.repository.name }}
20+
21+
jobs:
22+
build-push:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Setup Kustomize
27+
uses: fluxcd/pkg/actions/kustomize@main
28+
- name: Prepare
29+
id: prep
30+
run: |
31+
VERSION="${{ github.event.inputs.tag }}-${GITHUB_SHA::8}"
32+
if [[ $GITHUB_REF == refs/tags/* ]]; then
33+
VERSION=${GITHUB_REF/refs\/tags\//}
34+
fi
35+
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
36+
echo ::set-output name=VERSION::${VERSION}
37+
- name: Setup QEMU
38+
uses: docker/setup-qemu-action@v1
39+
with:
40+
platforms: all
41+
- name: Setup Docker Buildx
42+
id: buildx
43+
uses: docker/setup-buildx-action@v1
44+
with:
45+
buildkitd-flags: "--debug"
46+
- name: Login to GitHub Container Registry
47+
uses: docker/login-action@v1
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Generate images meta
53+
id: meta
54+
uses: docker/metadata-action@v3
55+
with:
56+
images: |
57+
ghcr.io/doodlescheduling/${{ env.CONTROLLER }}
58+
tags: |
59+
type=raw,value=${{ steps.prep.outputs.VERSION }}
60+
- name: Publish multi-arch container image
61+
uses: docker/build-push-action@v2
62+
with:
63+
push: true
64+
builder: ${{ steps.buildx.outputs.name }}
65+
context: .
66+
file: ./Dockerfile
67+
platforms: linux/amd64,linux/arm/v7,linux/arm64
68+
tags: ${{ steps.meta.outputs.tags }}
69+
labels: ${{ steps.meta.outputs.labels }}
70+
- name: Check images
71+
run: |
72+
docker buildx imagetools inspect ghcr.io/doodlescheduling/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
73+
docker pull ghcr.io/doodlescheduling/${{ env.CONTROLLER }}:${{ steps.prep.outputs.VERSION }}
74+
- name: Generate release manifests
75+
if: startsWith(github.ref, 'refs/tags/v')
76+
run: |
77+
mkdir -p config/release
78+
kustomize build ./config/crd > ./config/release/${{ env.CONTROLLER }}.crds.yaml
79+
kustomize build ./config/manager > ./config/release/${{ env.CONTROLLER }}.deployment.yaml
80+
echo '[CHANGELOG](https://github.com/DoodleScheduling/${{ env.CONTROLLER }}/blob/master/CHANGELOG.md)' > ./config/release/notes.md
81+
- uses: anchore/sbom-action/download-syft@v0
82+
- name: Create release and SBOM
83+
if: startsWith(github.ref, 'refs/tags/v')
84+
uses: goreleaser/goreleaser-action@v2
85+
with:
86+
version: latest
87+
args: release --release-notes=config/release/notes.md --rm-dist --skip-validate
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: size-label
2+
on: pull_request
3+
jobs:
4+
size-label:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: size-label
8+
uses: "pascalgn/size-label-action@851c37f157f7d64e56f41ff5d2d80316299b2d47"
9+
env:
10+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)