Add sampleapp content + Gitea Actions CI/CD workflow
sampleapp-cicd / ci (push) Successful in 43s
sampleapp-cicd / deploy (push) Successful in 2s

This commit is contained in:
2026-07-18 16:15:11 +02:00
parent c3f7b4c8f7
commit 33f7c16ee2
3 changed files with 105 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
name: sampleapp-cicd
on:
push:
branches: ["**"]
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
env:
REGISTRY: gitea.tests01.helity.org
IMAGE: gitea.tests01.helity.org/lab/sampleapp
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Lint / validate content
run: |
set -e
test -f index.html
test -f Dockerfile
grep -q "<title>" index.html
grep -q "FROM nginx" Dockerfile
echo "lint OK"
- name: Inject commit SHA into page
run: |
set -e
sed -i "s/__GIT_SHA__/${GITHUB_SHA}/g" index.html
grep -q "${GITHUB_SHA}" index.html && echo "sha injected: ${GITHUB_SHA}"
- name: Build image
run: |
set -e
docker build -t "${IMAGE}:${GITHUB_SHA}" -t "${IMAGE}:latest" .
- name: Push image (main only)
if: github.ref == 'refs/heads/main'
run: |
set -e
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${REGISTRY}" -u "${{ secrets.REGISTRY_USER }}" --password-stdin
docker push "${IMAGE}:${GITHUB_SHA}"
docker push "${IMAGE}:latest"
docker logout "${REGISTRY}"
deploy:
runs-on: ubuntu-latest
needs: ci
if: github.ref == 'refs/heads/main'
steps:
- name: Trigger Rundeck deploy job
run: |
set -e
code=$(curl -fsS -o /tmp/rd.json -w '%{http_code}' -X POST \
-H "X-Rundeck-Auth-Token: ${{ secrets.RUNDECK_TOKEN }}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
"${{ secrets.RUNDECK_URL }}/api/40/job/${{ secrets.DEPLOY_JOB_UUID }}/run" \
--data "{\"options\":{\"image_tag\":\"${GITHUB_SHA}\"}}")
echo "Rundeck run HTTP ${code}"
python3 -c "import json;d=json.load(open('/tmp/rd.json'));print('execution id:',d.get('id'),'status:',d.get('status'),'permalink:',d.get('permalink'))"
+3
View File
@@ -0,0 +1,3 @@
FROM nginx:alpine
COPY index.html /usr/share/nginx/html/index.html
EXPOSE 80
+40
View File
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>sampleapp — CI/CD deployed</title>
<style>
body { font-family: system-ui, sans-serif; margin: 0; background: #0d1117; color: #e6edf3; }
main { max-width: 680px; margin: 10vh auto; padding: 0 1.5rem; }
h1 { font-size: 1.9rem; margin-bottom: 0.3rem; }
.tag { display: inline-block; background: #238636; color: #fff; font-size: 0.75rem;
padding: 0.15rem 0.6rem; border-radius: 999px; letter-spacing: 0.03em; }
p { line-height: 1.6; color: #9da7b3; }
code { background: #161b22; padding: 0.12rem 0.4rem; border-radius: 4px; color: #e6edf3; }
.sha { font-size: 1.05rem; color: #58a6ff; }
ul { color: #9da7b3; line-height: 1.8; }
footer { margin-top: 2.2rem; font-size: 0.8rem; color: #6b7683; }
</style>
</head>
<body>
<main>
<span class="tag">sampleapp &middot; live</span>
<h1>Deployed via the GitOps pipeline</h1>
<p>
This page is served by the container image built and pushed by
<strong>Gitea Actions</strong>, then deployed to <code>rocky10</code> by a
<strong>Rundeck</strong> job that the CI workflow triggered over the Rundeck API.
</p>
<p class="sha">commit __GIT_SHA__</p>
<p>The pipeline that produced this page:</p>
<ul>
<li>push to <code>lab/sampleapp</code> on the lab Gitea</li>
<li>Gitea Actions runner: lint &rarr; <code>docker build</code> &rarr; push image to the Gitea registry</li>
<li>on <code>main</code>: workflow calls the Rundeck API</li>
<li>Rundeck deploys this image on rocky10 and writes an audited marker on debian13b via Teleport</li>
</ul>
<footer>Elyrix lab &middot; Gitea Actions &rarr; Rundeck CI/CD demo</footer>
</main>
</body>
</html>