CHORE(app): test Tekton CI/CD pipeline
- Update about-us page timestamp - Trigger Tekton build via webhook
This commit is contained in:
@@ -1,102 +0,0 @@
|
|||||||
name: Build and Push to Zot
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: zot0213.kro.kr
|
|
||||||
IMAGE_NAME: jovies
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push:
|
|
||||||
runs-on: k3s-home
|
|
||||||
steps:
|
|
||||||
- name: Create Build Job
|
|
||||||
run: |
|
|
||||||
JOB_NAME="buildah-jovies-$(echo $GITHUB_SHA | cut -c1-7)"
|
|
||||||
echo "Creating Buildah Job: $JOB_NAME"
|
|
||||||
|
|
||||||
cat <<EOF | kubectl apply -f -
|
|
||||||
apiVersion: batch/v1
|
|
||||||
kind: Job
|
|
||||||
metadata:
|
|
||||||
name: $JOB_NAME
|
|
||||||
namespace: gitea
|
|
||||||
spec:
|
|
||||||
ttlSecondsAfterFinished: 600
|
|
||||||
backoffLimit: 0
|
|
||||||
template:
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: buildah
|
|
||||||
image: quay.io/buildah/stable:latest
|
|
||||||
securityContext:
|
|
||||||
privileged: true
|
|
||||||
command: ["/bin/bash", "-c"]
|
|
||||||
args:
|
|
||||||
- |
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# Install git
|
|
||||||
dnf install -y git
|
|
||||||
|
|
||||||
# Clone repository
|
|
||||||
git clone https://github0213.com/Mayne0213/jovies.git /workspace
|
|
||||||
cd /workspace/nextjs
|
|
||||||
|
|
||||||
# Login to registry
|
|
||||||
buildah login -u \$(cat /secrets/username) -p \$(cat /secrets/password) ${REGISTRY}
|
|
||||||
|
|
||||||
# Build image locally
|
|
||||||
buildah build --format oci -t localhost/${IMAGE_NAME}:${GITHUB_SHA} .
|
|
||||||
|
|
||||||
# Create manifest list for multi-platform compatibility
|
|
||||||
buildah manifest create ${REGISTRY}/${IMAGE_NAME}:latest
|
|
||||||
buildah manifest add ${REGISTRY}/${IMAGE_NAME}:latest localhost/${IMAGE_NAME}:${GITHUB_SHA}
|
|
||||||
|
|
||||||
# Push manifest list as latest
|
|
||||||
buildah manifest push --all ${REGISTRY}/${IMAGE_NAME}:latest docker://${REGISTRY}/${IMAGE_NAME}:latest
|
|
||||||
|
|
||||||
# Create and push manifest list with SHA tag
|
|
||||||
buildah manifest create ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA}
|
|
||||||
buildah manifest add ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} localhost/${IMAGE_NAME}:${GITHUB_SHA}
|
|
||||||
buildah manifest push --all ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA} docker://${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA}
|
|
||||||
|
|
||||||
echo "Done!"
|
|
||||||
env:
|
|
||||||
- name: REGISTRY
|
|
||||||
value: "${REGISTRY}"
|
|
||||||
- name: IMAGE_NAME
|
|
||||||
value: "${IMAGE_NAME}"
|
|
||||||
- name: GITHUB_SHA
|
|
||||||
value: "${GITHUB_SHA}"
|
|
||||||
volumeMounts:
|
|
||||||
- name: zot-creds
|
|
||||||
mountPath: /secrets
|
|
||||||
volumes:
|
|
||||||
- name: zot-creds
|
|
||||||
secret:
|
|
||||||
secretName: zot-registry-credentials-plain
|
|
||||||
restartPolicy: Never
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Wait for Build Job
|
|
||||||
run: |
|
|
||||||
JOB_NAME="buildah-jovies-$(echo $GITHUB_SHA | cut -c1-7)"
|
|
||||||
echo "Waiting for Job: $JOB_NAME"
|
|
||||||
|
|
||||||
if ! kubectl wait --for=condition=complete job/$JOB_NAME -n gitea --timeout=900s; then
|
|
||||||
echo "Job failed. Logs:"
|
|
||||||
kubectl logs job/$JOB_NAME -n gitea --all-containers
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Build and push completed successfully!"
|
|
||||||
|
|
||||||
- name: Cleanup
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
JOB_NAME="buildah-jovies-$(echo $GITHUB_SHA | cut -c1-7)"
|
|
||||||
kubectl delete job $JOB_NAME -n gitea --ignore-not-found
|
|
||||||
73
.github/workflows/build.yml
vendored
73
.github/workflows/build.yml
vendored
@@ -1,73 +0,0 @@
|
|||||||
name: Build Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push:
|
|
||||||
runs-on: ubuntu-24.04-arm
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
image-tag: ${{ steps.meta.outputs.tags }}
|
|
||||||
image-digest: ${{ steps.build.outputs.digest }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.CR_PAT }}
|
|
||||||
|
|
||||||
- name: Lowercase repository name
|
|
||||||
id: lowercase
|
|
||||||
run: |
|
|
||||||
echo "repo=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels)
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ steps.lowercase.outputs.repo }}
|
|
||||||
tags: |
|
|
||||||
type=sha,prefix=sha-,format=long
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
id: build
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: ./nextjs
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: true
|
|
||||||
platforms: linux/arm64
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: Display image information
|
|
||||||
run: |
|
|
||||||
echo "Image built and pushed successfully!"
|
|
||||||
echo "Image tags:"
|
|
||||||
echo "${{ steps.meta.outputs.tags }}"
|
|
||||||
echo "Digest: ${{ steps.build.outputs.digest }}"
|
|
||||||
45
.github/workflows/ci.yml
vendored
45
.github/workflows/ci.yml
vendored
@@ -1,45 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint-and-build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
cache-dependency-path: nextjs/package-lock.json
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: nextjs
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run ESLint
|
|
||||||
working-directory: nextjs
|
|
||||||
run: npm run lint
|
|
||||||
|
|
||||||
- name: Build Next.js application
|
|
||||||
working-directory: nextjs
|
|
||||||
run: npm run build
|
|
||||||
env:
|
|
||||||
NEXT_TELEMETRY_DISABLED: 1
|
|
||||||
|
|
||||||
- name: Check build output
|
|
||||||
working-directory: nextjs
|
|
||||||
run: |
|
|
||||||
if [ ! -d ".next" ]; then
|
|
||||||
echo "Build failed: .next directory not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Build completed successfully"
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export default function AboutUs(){
|
export default function AboutUs(){
|
||||||
return <div>Practice app for K8s/argoCD/Grafana - Updated at 2026-01-09 16:02 KST</div>
|
return <div>Practice app for K8s/argoCD/Grafana - Updated at 2026-01-11 00:35 KST (Tekton CI/CD)</div>
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user