Skip to content

Commit eea0ace

Browse files
committed
adapt to puzzle techlab setup
1 parent 67882dc commit eea0ace

28 files changed

+849
-412
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: "🎯 Epic"
3+
about: "Large feature or initiative requiring multiple tasks"
4+
title: "Epic: "
5+
labels: ["epic"]
6+
assignees: []
7+
8+
---
9+
10+
## 🎯 Epic Description
11+
Describe the larger feature or initiative.
12+
13+
## 📝 Subtasks
14+
- [ ] Task 1
15+
- [ ] Task 2
16+
- [ ] Task 3
17+
18+
## 📌 Additional Context
19+
Any extra information.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: "🐞 Bug Report"
3+
about: "Report an issue to help us improve the project"
4+
title: "🐞 Bug: "
5+
labels: ["bug"]
6+
assignees: []
7+
8+
---
9+
10+
## **🐞 Describe the Bug**
11+
A clear and concise description of the bug, including what is happening and why it is an issue.
12+
13+
## **🔄 Steps to Reproduce**
14+
1. Go to '...'
15+
2. Click on '...'
16+
3. Perform '...'
17+
4. See the error
18+
19+
## **💡 Expected Behavior**
20+
A clear description of what should happen instead.
21+
22+
## **🖥️ Environment (please complete the following information)**
23+
- OS: [e.g., Windows, macOS, Linux]
24+
- Database (if applicable): [e.g., PostgreSQL, Oracle, MySQL]
25+
- Application version: [e.g., 1.0.0]
26+
27+
## **📷 Screenshots (if applicable)**
28+
If applicable, add screenshots to help explain the problem.
29+
30+
## **🏷️ Priority (Select one)**
31+
- [ ] 🔴 **High** – Blocks critical functionality, needs immediate attention.
32+
- [ ] 🟠 **Medium** – Causes issues but has a workaround.
33+
- [ ] 🟢 **Low** – Minor issue, does not impact core functionality.
34+
35+
## **📌 Additional Context**
36+
Add any other relevant information, logs, or references.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: "📌 Task"
3+
about: "Define and track a specific task"
4+
title: "📌 Task: "
5+
labels: ["task"]
6+
assignees: []
7+
8+
---
9+
10+
## 📌 Task Description
11+
Describe the task that needs to be completed.
12+
13+
## ✅ To-Do
14+
- [ ] Step 1
15+
- [ ] Step 2
16+
- [ ] Step 3
17+
18+
## 📌 Additional Context
19+
Any other relevant information.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: "📖 Documentation Update"
3+
about: "Suggest an improvement to the project documentation"
4+
title: "📖 Docs: "
5+
labels: ["documentation"]
6+
assignees: []
7+
8+
---
9+
10+
## 📖 Documentation Update
11+
Describe the necessary changes.
12+
13+
## 📌 Affected Pages
14+
List the pages or files that need updates.
15+
16+
## 📌 Additional Context
17+
Provide any links or references.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: "🚀 Feature Request"
3+
about: "Propose a new feature or improvement for the project"
4+
title: "🚀 Feature: "
5+
labels: ["feature", "enhancement"]
6+
assignees: []
7+
8+
---
9+
10+
## 📝 Feature Request
11+
12+
### 🔹 Is your feature request related to a problem? Please describe.
13+
A clear and concise description of the issue. Example: "I often encounter situations where [...]"
14+
15+
### 🚀 Describe the solution you'd like
16+
Provide a detailed explanation of the desired feature and how it should work.
17+
18+
### 🔄 Describe alternatives you've considered
19+
List any alternative solutions or workarounds you have explored.
20+
21+
### 📌 Additional context
22+
Add any other relevant context, screenshots, or references related to the feature request.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: "🛠️ Refactor"
3+
about: "Suggest code improvements that do not change functionality"
4+
title: "🛠️Refactor: "
5+
labels: ["refactor", "enhancement"]
6+
assignees: []
7+
8+
---
9+
10+
## 🔄 Refactor Proposal
11+
**What needs to be refactored and why?**
12+
Clearly describe the code section that requires refactoring and the reason behind the change.
13+
14+
## ✅ Expected Improvements
15+
**What are the benefits of this refactor?**
16+
Explain how this change improves code readability, maintainability, performance, or scalability.
17+
18+
## 🏷️ Priority (Select one)
19+
- [ ] 🔴 **High** – Critical refactor that impacts core functionality.
20+
- [ ] 🟠 **Medium** – Important but not urgent, improves maintainability.
21+
- [ ] 🟢 **Low** – Minor change for better clarity, no functional impact.
22+
23+
## 📌 Additional Context
24+
**Relevant links or discussions**
25+
Include related issues, discussions, or references that provide more background on this refactor.
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
name: Backstage Techlab Puzzle Build and Publish
2+
3+
permissions:
4+
contents: read
5+
packages: write
6+
id-token: write
7+
pull-requests: write
8+
9+
on:
10+
pull_request:
11+
workflow_dispatch:
12+
push:
13+
branches:
14+
- main
15+
16+
env:
17+
REGISTRY: ghcr.io
18+
IMAGE_NAME: ${{ github.repository }}
19+
HELM_NAME: backstage-techlab-puzzle
20+
TRAINING_VERSION: ${{ github.sha }}
21+
BUILD_VERSION: ${{ github.ref == 'refs/heads/main' && 'latest' || format('pr-{0}', github.event.pull_request.number) }}
22+
DEPLOY_SECRET_VARIABLE_NAME: ${{ github.ref == 'refs/heads/main' && 'KUBECONFIG_PROD_AV2' || 'KUBECONFIG_TEST_AV2' }}
23+
NAMESPACE_NAME: ${{ github.ref == 'refs/heads/main' && 'pitc-cicd-backstage-techlab-prod' || 'pitc-cicd-backstage-techlab-test' }}
24+
PR_ENV_URL: https://backstage-techlab-pr-${{ github.event.pull_request.number }}.ocp.cloudscale.puzzle.ch
25+
26+
jobs:
27+
lint:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Set up npm for linting
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 'latest'
36+
- name: Cache npm dependencies
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.npm
40+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
41+
restore-keys: |
42+
${{ runner.os }}-node-
43+
- name: Cache node_modules
44+
uses: actions/cache@v4
45+
with:
46+
path: node_modules
47+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
48+
restore-keys: |
49+
${{ runner.os }}-modules-
50+
- name: Lint Markdown
51+
run: npm ci && npm run mdlint
52+
53+
54+
build_push_image:
55+
runs-on: ubuntu-latest
56+
needs: lint
57+
outputs:
58+
digest: ${{ steps.build-push.outputs.digest }}
59+
steps:
60+
- name: Checkout Repository
61+
uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
- name: Set up QEMU
65+
uses: docker/setup-qemu-action@v3
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
- name: Log into registry ${{ env.REGISTRY }}
69+
uses: docker/login-action@v3
70+
with:
71+
registry: ${{ env.REGISTRY }}
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
- name: Push Docker image
75+
id: build-push
76+
uses: docker/build-push-action@v6
77+
with:
78+
context: .
79+
file: ./Dockerfile
80+
push: true
81+
tags: |
82+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_VERSION }}
83+
cache-from: type=gha
84+
cache-to: type=gha,mode=max
85+
86+
sign_image:
87+
runs-on: ubuntu-latest
88+
needs: build_push_image
89+
outputs:
90+
digest: ${{ needs.build_push_image.outputs.digest }}
91+
steps:
92+
- name: Log into registry ${{ env.REGISTRY }}
93+
uses: docker/login-action@v3
94+
with:
95+
registry: ${{ env.REGISTRY }}
96+
username: ${{ github.actor }}
97+
password: ${{ secrets.GITHUB_TOKEN }}
98+
- name: Install cosign
99+
uses: sigstore/cosign-installer@v3.8.2
100+
with:
101+
cosign-release: 'v2.2.4'
102+
- name: Sign Docker image with cosign
103+
env:
104+
TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_VERSION }}
105+
DIGEST: ${{ needs.build_push_image.outputs.digest }}
106+
run: |
107+
COSIGN_EXPERIMENTAL=1 cosign sign --yes ${TAG}@${DIGEST}
108+
109+
verify_image:
110+
runs-on: ubuntu-latest
111+
needs: sign_image
112+
outputs:
113+
digest: ${{ needs.sign_image.outputs.digest }}
114+
steps:
115+
- name: Checkout Repository
116+
uses: actions/checkout@v4
117+
with:
118+
sparse-checkout: |
119+
scripts
120+
sparse-checkout-cone-mode: false
121+
fetch-depth: 0
122+
- name: Log into registry ${{ env.REGISTRY }}
123+
uses: docker/login-action@v3
124+
with:
125+
registry: ${{ env.REGISTRY }}
126+
username: ${{ github.actor }}
127+
password: ${{ secrets.GITHUB_TOKEN }}
128+
- name: Install cosign
129+
uses: sigstore/cosign-installer@v3.8.2
130+
with:
131+
cosign-release: 'v2.2.4'
132+
- name: Verify Docker image with cosign
133+
env:
134+
TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_VERSION }}
135+
DIGEST: ${{ needs.sign_image.outputs.digest }}
136+
run: bash ./scripts/verify_cosign.sh
137+
138+
deploy:
139+
runs-on: ubuntu-latest
140+
needs: verify_image
141+
env:
142+
KUBE_CONFIG_PATH: '$HOME/.kube'
143+
KUBE_CONFIG_FILENAME: 'config'
144+
steps:
145+
- name: Checkout Repository
146+
uses: actions/checkout@v4
147+
with:
148+
sparse-checkout: |
149+
helm-chart
150+
scripts
151+
sparse-checkout-cone-mode: false
152+
fetch-depth: 0
153+
- name: 'Install Helm'
154+
uses: azure/setup-helm@v4
155+
with:
156+
version: 'latest'
157+
- name: Install Kubectl
158+
uses: azure/setup-kubectl@v4
159+
with:
160+
version: 'latest'
161+
- name: Create KUBECONFIG
162+
env:
163+
KUBE_CONFIG: ${{ secrets[env.DEPLOY_SECRET_VARIABLE_NAME] }}
164+
run: bash ./scripts/create_kubeconfig.sh
165+
- name: Deploy Helm Release
166+
env:
167+
HELM_RELEASE: ${{ env.BUILD_VERSION }}
168+
NAMESPACE: ${{ env.NAMESPACE_NAME }}
169+
run: bash ./scripts/deploy_helm_release.sh
170+
- name: Redeploy Deployments
171+
env:
172+
HELM_RELEASE: ${{ env.BUILD_VERSION }}
173+
NAMESPACE: ${{ env.NAMESPACE_NAME }}
174+
run: bash ./scripts/redeploy_deployment.sh
175+
176+
comment:
177+
if: github.ref != 'refs/heads/main'
178+
runs-on: ubuntu-latest
179+
needs: verify_image
180+
steps:
181+
- name: Comment PR Environments in PR
182+
uses: marocchino/sticky-pull-request-comment@v2
183+
with:
184+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
message: |
186+
🚀 PR Environment: [Open Deployment](${{ env.PR_ENV_URL }})
187+
🏷️ Image Tag: `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.BUILD_VERSION }}`
188+
🖋️ Image Digest: `${{ needs.verify_image.outputs.digest }}`

0 commit comments

Comments
 (0)