Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis committed Jun 6, 2024
0 parents commit 9f858f9
Show file tree
Hide file tree
Showing 74 changed files with 23,486 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

#### Describe the bug
A clear and concise description of what the bug is.

#### To Reproduce
Steps to reproduce the behavior:

#### Expected behavior
A clear and concise description of what you expected to happen.

#### Environment
- controller version: [e.g. v1.0.0]
- keycloak version: [e.g. v15.0.0]
- kubernetes version: [e.g. v1.19.0]

#### Additional context
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/change_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Change request
about: Propose a change for an already implemented solution
title: ''
labels: change
assignees: ''

---

#### Describe the change
A clear and concise description of what the change is about.

#### Current situation
Describe the current situation.

#### Should
Describe the changes you would like to propose.

#### Additional context
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature
assignees: ''

---

#### Is your feature request related to a problem? Please describe
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

#### Describe the solution you'd like
A clear and concise description of what you want to happen.

#### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

#### Additional context
Add any other context or screenshots about the feature request here.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Current situation
<!--- Shortly describe the current situation -->

## Proposal
<!--- Describe what this PR is intended to achieve -->
27 changes: 27 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: main

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.22.x
- name: Tests
run: make test
- name: Send go coverage report
uses: shogo82148/actions-goveralls@785c9d68212c91196d3994652647f8721918ba11 # v1.9.0
with:
path-to-profile: coverage.out
224 changes: 224 additions & 0 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
name: pr-build

on:
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
lint-chart:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 #v3.5
with:
version: v3.4.0

- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch=master --chart-dirs chart)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --target-branch=master --chart-dirs chart --check-version-increment=false

fmt:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.22.x
- name: fmt
run: make fmt
- name: vet
run: make vet
- name: lint
run: make lint
- name: Check if working tree is dirty
run: |
if [[ $(git diff --stat) != '' ]]; then
git --no-pager diff
echo 'run <make test> and commit changes'
exit 1
fi
test:
runs-on: ubuntu-latest
strategy:
matrix:
kubernetes-version:
- "1.27"
- "1.28"
- "1.29"
- "1.30"
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.22.x
- name: run test
run: make test ENVTEST_K8S_VERSION=${{ matrix.kubernetes-version }}

build:
runs-on: ubuntu-latest
outputs:
profiles: ${{ steps.profiles.outputs.matrix }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.22.x
- name: build
run: make build
- name: Check if working tree is dirty
run: |
if [[ $(git diff --stat) != '' ]]; then
git --no-pager diff
echo 'run <make test> and commit changes'
exit 1
fi
- name: Build container image
run: |
make docker-build
- name: Create image tarball
run: |
docker save --output swagger-hub-controller-container.tar swagger-hub-controller:latest
- name: Upload image
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: swagger-hub-controller-container
path: swagger-hub-controller-container.tar
- id: profiles
name: Determine test profiles
run: |
profiles=$(ls config/tests/cases | jq -R -s -c 'split("\n")[:-1]')
echo $profiles
echo "::set-output name=matrix::$profiles"
e2e-tests:
runs-on: ubuntu-latest
needs:
- build
strategy:
matrix:
profile: ${{ fromJson(needs.build.outputs.profiles) }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.22.x
- name: Setup Kubernetes
uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 #v0.5.0
with:
version: v0.17.0
- name: Download swagger-hub-controller container
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a #v3.0.2
with:
name: swagger-hub-controller-container
path: /tmp
- name: Load images
run: |
docker load --input /tmp/swagger-hub-controller-container.tar
docker image ls -a
- name: Setup Kustomize
uses: imranismail/setup-kustomize@2ba527d4d055ab63514ba50a99456fc35684947f # v2.1.0
- name: Run test
run: |
make kind-test TEST_PROFILE=${{ matrix.profile }}
- name: Debug failure
if: failure()
run: |
kubectl -n kube-system describe pods
kubectl -n swagger-system describe pods
kubectl -n swagger-system get all
kubectl -n swagger-system logs deploy/swagger-hub-controller
kubectl -n swagger-system get swaggerhubs -o yaml
test-chart:
runs-on: ubuntu-latest
needs:
- build
- lint-chart
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 #v3.5

- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Create kind cluster
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0

- name: Download swagger-hub-controller container
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: swagger-hub-controller-container
path: /tmp

- name: Load image
run: |
docker load --input /tmp/swagger-hub-controller-container.tar
docker tag swagger-hub-controller:latest ghcr.io/doodlescheduling/swagger-hub-controller:v0.0.0
kind load docker-image ghcr.io/doodlescheduling/swagger-hub-controller:v0.0.0 --name chart-testing
docker image ls -a
- name: Run chart-testing (install)
run: ct install --target-branch=master --chart-dirs chart
18 changes: 18 additions & 0 deletions .github/workflows/pr-label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: pr-label

on:
pull_request:

jobs:
size-label:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: size-label
uses: "pascalgn/size-label-action@b1f4946f381d38d3b5960f76b514afdfef39b609"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
25 changes: 25 additions & 0 deletions .github/workflows/rebase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: rebase

on:
pull_request:
types: [opened]
issue_comment:
types: [created]

jobs:
rebase:
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')
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout the latest code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 #1.8
env:
GITHUB_TOKEN: ${{ github.token }}
Loading

0 comments on commit 9f858f9

Please sign in to comment.