Skip to content

Commit 3df1618

Browse files
authored
Release v1 (#2)
2 parents c24bbf1 + bc5e50b commit 3df1618

20 files changed

Lines changed: 793 additions & 30 deletions

.github/workflows/cla-assistant.yml

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,7 @@ permissions:
1414
jobs:
1515
CLAAssistant:
1616
name: "CLA Assistant"
17-
runs-on: ubuntu-latest
18-
steps:
19-
- name: "CLA Assistant"
20-
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
21-
uses: contributor-assistant/github-action@v2.6.1
22-
env:
23-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ASSISTANT_PAT }}
25-
with:
26-
path-to-signatures: "signatures/instancing-fallback/v1/cla.json"
27-
path-to-document: "https://github.com/ctfpilot/cla/blob/1a3a56410df569e0672aafd508044da85f194e8b/CLA.md"
28-
29-
# branch should not be protected
30-
branch: "main"
31-
allowlist: ""
32-
lock-pullrequest-aftermerge: false
33-
use-dco-flag: false
34-
35-
# Remote CLA repo
36-
remote-organization-name: "ctfpilot"
37-
remote-repository-name: "cla"
38-
create-file-commit-message: "Creating file for storing CLA Signatures"
39-
signed-commit-message: "$contributorName has signed the CLA in $owner/$repo"
40-
custom-notsigned-prcomment: 'Thank you for your contribution! Before we can proceed, please sign the Contributor License Agreement (CLA) by replying to this comment with "I have read the CLA Document and I hereby sign the CLA". You can find the CLA document [here](https://github.com/ctfpilot/cla/blob/1a3a56410df569e0672aafd508044da85f194e8b/CLA.md).'
41-
custom-pr-sign-comment: "I have read the CLA Document and I hereby sign the CLA"
42-
custom-allsigned-prcomment: "All Contributors have signed the CLA. Thank you for your cooperation!"
17+
uses: ctfpilot/ci/.github/workflows/cla-assistant.yml@v1.1.2
18+
secrets: inherit
19+
with:
20+
repository: instance-fallback

.github/workflows/release.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,38 @@ jobs:
1313
packages: write
1414
id-token: write
1515
name: Release
16-
if: github.repository == 'ctfpilot/instancing-fallback'
17-
uses: the0mikkel/ci/.github/workflows/semver-release-standalone.yml@v1.4.0
16+
uses: ctfpilot/ci/.github/workflows/release.yml@v1.1.1
17+
secrets:
18+
RELEASE_GH_TOKEN: ${{ secrets.RELEASE_GH_TOKEN }}
19+
with:
20+
repository: ctfpilot/instancing-fallback
21+
ENVIRONMENT: Release
22+
23+
docker:
24+
name: Docker build and push
25+
needs:
26+
- release
27+
uses: ctfpilot/ci/.github/workflows/docker.yml@v1.1.1
28+
if: needs.release.outputs.version != '' && needs.release.outputs.version != null
29+
permissions:
30+
contents: read
31+
packages: write
32+
id-token: write
33+
with:
34+
repository: ctfpilot/instancing-fallback
35+
semver: ${{ needs.release.outputs.version }}
36+
arguments: |
37+
VERSION=${{ needs.release.outputs.version }}
38+
39+
update-develop:
40+
if: github.ref == 'refs/heads/main'
41+
name: "Update Develop Branch"
42+
needs:
43+
- release
44+
uses: ctfpilot/ci/.github/workflows/develop-update.yml@v1.2.0
45+
permissions:
46+
contents: read
47+
pull-requests: write
48+
issues: write
49+
with:
50+
repository: ctfpilot/instancing-fallback

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public/

.releaserc.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
[
3131
"@semantic-release/exec",
3232
{
33-
"prepareCmd": "echo ${nextRelease.version} > version.txt",
33+
"prepareCmd": "echo ${nextRelease.version} > version.txt && cp template/k8s.yml k8s/k8s.yml && sed -i 's/{ .Version }/${nextRelease.version}/g' k8s/k8s.yml",
3434
"publishCmd": "echo 'Published version ${nextRelease.version}'"
3535
}
3636
],
3737
[
3838
"@semantic-release/git",
3939
{
40-
"assets": [],
40+
"assets": [
41+
"k8s/k8s.yml"
42+
],
4143
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
4244
}
4345
]

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Require review from security/maintainers for workflows
2+
.releaserc.json @ctfpilot/devops

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.14-slim AS builder
2+
3+
WORKDIR /app
4+
5+
COPY src/ /app/src
6+
7+
RUN python3 src/generator.py
8+
9+
FROM joseluisq/static-web-server
10+
11+
COPY --from=builder /app/public/ /public
12+
13+
ENV SERVER_CACHE_CONTROL_HEADERS=false

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ The service can also be run locally, using the provided Docker compose file:
2020
docker compose up -d
2121
```
2222

23+
### Development
24+
25+
In order to generate the pages, run the [`generator.py`](./src/generator.py) script in `src`:
26+
27+
```sh
28+
python3 src/generator.py
29+
```
30+
31+
*This is done automatically in the Docker container build process.*
32+
2333
## Contributing
2434

2535
We welcome contributions of all kinds, from **code** and **documentation** to **bug reports** and **feedback**!

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
instancing-fallback:
3+
build: .
4+
ports:
5+
- "8080:80"
6+
restart: always
7+
development:
8+
image: joseluisq/static-web-server
9+
ports:
10+
- "8081:80"
11+
volumes:
12+
- ./public:/public
13+
restart: always

k8s/k8s.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: instance-fallback
5+
labels:
6+
app.kubernetes.io/part-of: ctfpilot
7+
app.kubernetes.io/name: instance-fallback
8+
app.kubernetes.io/version: 1.0.0-r.2
9+
app.kubernetes.io/component: challenges
10+
ctfpilot.com/component: instance-fallback
11+
12+
spec:
13+
# HA setup
14+
replicas: 3
15+
selector:
16+
matchLabels:
17+
ctfpilot.com/component: instance-fallback
18+
19+
template:
20+
metadata:
21+
labels:
22+
ctfpilot.com/component: instance-fallback
23+
spec:
24+
enableServiceLinks: false
25+
automountServiceAccountToken: false
26+
containers:
27+
- name: instancing-fallback
28+
image: ctfpilot/instance-fallback:1.0.0-r.2
29+
imagePullPolicy: Always
30+
ports:
31+
- name: http
32+
containerPort: 80
33+
resources:
34+
requests:
35+
memory: "128Mi"
36+
cpu: "10m"
37+
limits:
38+
memory: "256Mi"
39+
cpu: "100m"
40+
livenessProbe:
41+
httpGet:
42+
path: /
43+
port: 80
44+
initialDelaySeconds: 5
45+
periodSeconds: 10
46+
---
47+
apiVersion: v1
48+
kind: Service
49+
metadata:
50+
name: instance-fallback
51+
labels:
52+
app.kubernetes.io/part-of: ctfpilot
53+
app.kubernetes.io/name: instance-fallback
54+
app.kubernetes.io/version: 1.0.0-r.2
55+
app.kubernetes.io/component: challenges
56+
ctfpilot.com/component: instance-fallback
57+
spec:
58+
selector:
59+
ctfpilot.com/component: instance-fallback
60+
ports:
61+
- name: http
62+
port: 80
63+
targetPort: http

src/content/error_404.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h1>The challenge instance is offline</h1>
2+
<p>
3+
Please start your challenge or wait a few moments for the instance to become available, if you have already started
4+
it. <br />
5+
This may take a few minutes. You may see "No Available Server", "Bad Gateway" or "Service Unavailable", this is
6+
normal and you will just need to wait a bit longer.
7+
</p>

0 commit comments

Comments
 (0)