Skip to content

Commit 7dc3b16

Browse files
Merge pull request #1 from discoverygarden/implementation
FDSF-295: Implementation
2 parents 4de0c3f + d6d9f70 commit 7dc3b16

File tree

69 files changed

+4696
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4696
-42
lines changed

.github/workflows/auto-semver.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Auto Semver
3+
on:
4+
pull_request:
5+
types: closed
6+
branches:
7+
- main
8+
jobs:
9+
update:
10+
if: "github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'no-update')"
11+
runs-on: ubuntu-latest
12+
outputs:
13+
tag: ${{ steps.semver.outputs.tag }}
14+
steps:
15+
- name: Run Auto Semver
16+
id: semver
17+
uses: discoverygarden/auto-semver@v1
18+
build:
19+
if: github.event.pull_request.merged == true && needs.update.outputs.tag
20+
uses: ./.github/workflows/build-image-from-tag-push.yml
21+
needs: update
22+
secrets: inherit
23+
permissions:
24+
id-token: write
25+
contents: read
26+
with:
27+
tag: ${{ needs.update.outputs.tag }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bot Pull-Request to Ticket
3+
on:
4+
pull_request:
5+
types: [opened]
6+
permissions:
7+
pull-requests: write
8+
repository-projects: read
9+
10+
jobs:
11+
bot-job:
12+
runs-on: ubuntu-latest
13+
if: "( github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]' ) && contains(github.event.pull_request.labels.*.name, 'major')"
14+
steps:
15+
- name: Create Issue
16+
uses: discoverygarden/create-issue@v1
17+
with:
18+
project: IT
19+
summary: "[${{ github.repository }}] ${{ github.actor }} update"
20+
description: |
21+
${{ github.actor }} generated a PR to update a dependency.
22+
transition: "Request QA Review"
23+
deployment-instructions: "N/A"
24+
jira-url: ${{ vars.JIRA_BASE_URL }}
25+
jira-user: ${{ vars.JIRA_USER_EMAIL }}
26+
jira-token: ${{ secrets.JIRA_API_TOKEN }}
27+
slack-webhook: ${{ secrets.FEED_WORKFLOW_WEBHOOK }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Build image from version tag
3+
4+
permissions:
5+
id-token: write
6+
contents: read
7+
on:
8+
push:
9+
# XXX: Tags pushed via actions (i.e., auto-semver) are not able to trigger additional workflows;
10+
# they should instead go via an additional workflow_call.
11+
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
12+
pull_request:
13+
branches: [ main ]
14+
workflow_call:
15+
inputs:
16+
tag:
17+
description: Base tag to build.
18+
required: false
19+
type: string
20+
21+
jobs:
22+
build:
23+
if: github.event_name == 'push' || github.event_name == 'pull_request'
24+
uses: discoverygarden/docker-image-reusable-workflows/.github/workflows/build-image.yml@v1
25+
secrets: inherit
26+
with:
27+
image-name: ${{ vars.DOCKER_IMAGE_NAME }}
28+
tag: ${{ inputs.tag }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Helm Chart releasing workflow.
2+
# Adapted from:
3+
# - https://github.com/helm/chart-releaser-action?tab=readme-ov-file#example-workflow
4+
# - https://github.com/discoverygarden/helm-charts/blob/main/.github/workflows/chart-releaser.yml
5+
name: Release Charts
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- "dist/*/Chart.yaml"
13+
14+
jobs:
15+
release:
16+
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
17+
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
18+
permissions:
19+
contents: write
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Configure Git
28+
run: |
29+
git config user.name "$GITHUB_ACTOR"
30+
git config user.email "[email protected]"
31+
32+
- name: Run chart-releaser
33+
uses: helm/chart-releaser-action@cae68fefc6b5f367a0275617c9f83181ba54714f # v1.7.0
34+
env:
35+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
36+
with:
37+
charts_dir: dist
38+
packages_with_index: true
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Enforce Labeling
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened, labeled, unlabeled]
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
check_labels:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Check Pull Request Labels
15+
uses: discoverygarden/enforce-label@v1
16+
with:
17+
required_labels: major,minor,patch,no-update
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Rebuild image
3+
4+
permissions:
5+
id-token: write
6+
contents: read
7+
on:
8+
schedule:
9+
- cron: '47 4 1 * *'
10+
workflow_dispatch:
11+
inputs:
12+
env:
13+
description: The env in which to rebuild.
14+
required: false
15+
type: choice
16+
default: prod
17+
options:
18+
- dev
19+
- prod
20+
21+
jobs:
22+
build:
23+
uses: discoverygarden/docker-image-reusable-workflows/.github/workflows/build-image.yml@v1
24+
secrets: inherit
25+
with:
26+
env: ${{ inputs.env || github.event_name == 'pull_request' && 'dev' || 'prod' }}
27+
image-name: ${{ vars.DOCKER_IMAGE_NAME }}

.github/workflows/test-chart.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Test Chart
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test-e2e:
9+
name: Run on Ubuntu
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Clone the code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Install the latest version of kind
21+
run: |
22+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
23+
chmod +x ./kind
24+
sudo mv ./kind /usr/local/bin/kind
25+
26+
- name: Verify kind installation
27+
run: kind version
28+
29+
- name: Create kind cluster
30+
run: kind create cluster
31+
32+
- name: Prepare solr-user-operator
33+
run: |
34+
go mod tidy
35+
make docker-build IMG=solr-user-operator:v0.1.0
36+
kind load docker-image solr-user-operator:v0.1.0
37+
38+
- name: Install Helm
39+
run: |
40+
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
41+
42+
- name: Verify Helm installation
43+
run: helm version
44+
45+
- name: Lint Helm Chart
46+
run: |
47+
helm lint ./dist/chart
48+
49+
# TODO: Uncomment if cert-manager is enabled
50+
# - name: Install cert-manager via Helm
51+
# run: |
52+
# helm repo add jetstack https://charts.jetstack.io
53+
# helm repo update
54+
# helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true
55+
#
56+
# - name: Wait for cert-manager to be ready
57+
# run: |
58+
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
59+
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
60+
# kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
61+
62+
# TODO: Uncomment if Prometheus is enabled
63+
# - name: Install Prometheus Operator CRDs
64+
# run: |
65+
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
66+
# helm repo update
67+
# helm install prometheus-crds prometheus-community/prometheus-operator-crds
68+
#
69+
# - name: Install Prometheus via Helm
70+
# run: |
71+
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
72+
# helm repo update
73+
# helm install prometheus prometheus-community/prometheus --namespace monitoring --create-namespace
74+
#
75+
# - name: Wait for Prometheus to be ready
76+
# run: |
77+
# kubectl wait --namespace monitoring --for=condition=available --timeout=300s deployment/prometheus-server
78+
79+
- name: Install Helm chart for project
80+
run: |
81+
helm install my-release ./dist/chart --create-namespace --namespace solr-user-operator-system
82+
83+
- name: Check Helm release status
84+
run: |
85+
helm status my-release --namespace solr-user-operator-system
86+
87+
# TODO: Uncomment if prometheus.enabled is set to true to confirm that the ServiceMonitor gets created
88+
# - name: Check Presence of ServiceMonitor
89+
# run: |
90+
# kubectl wait --namespace solr-user-operator-system --for=jsonpath='{.kind}'=ServiceMonitor servicemonitor/solr-user-operator-controller-manager-metrics-monitor

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Image URL to use all building/pushing image targets
2-
IMG ?= controller:latest
2+
IMG ?= solr-user-operator:latest
33

44
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
55
ifeq (,$(shell go env GOBIN))

PROJECT

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@
55
domain: dgicloud.com
66
layout:
77
- go.kubebuilder.io/v4
8+
plugins:
9+
helm.kubebuilder.io/v1-alpha: {}
810
projectName: solr-user-operator
911
repo: github.com/discoverygarden/solr-user-operator
12+
resources:
13+
- api:
14+
crdVersion: v1
15+
namespaced: true
16+
controller: true
17+
domain: dgicloud.com
18+
group: solr
19+
kind: User
20+
path: github.com/discoverygarden/solr-user-operator/api/v1alpha1
21+
version: v1alpha1
22+
- api:
23+
crdVersion: v1
24+
namespaced: true
25+
controller: true
26+
domain: dgicloud.com
27+
group: solr
28+
kind: Collection
29+
path: github.com/discoverygarden/solr-user-operator/api/v1alpha1
30+
version: v1alpha1
1031
version: "3"

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
132132
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133133
See the License for the specific language governing permissions and
134134
limitations under the License.
135-

0 commit comments

Comments
 (0)