commit 3826770c027a8990f59b4d9071c2bb9c4dc589f9 Author: bstein Date: Tue Dec 16 19:23:46 2025 -0300 chore: add pipeline diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3dee421 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,42 @@ +pipeline { + agent any + environment { + REGISTRY = 'registry.bstein.dev' + IMAGE = 'infra/harbor-arm-build' + } + stages { + stage('Checkout') { + steps { + git credentialsId: 'gitea-pat', url: 'https://scm.bstein.dev/bstein/harbor-arm-build.git' + } + } + stage('Build image') { + steps { + sh ''' + cat > app.sh <<'APP' + #!/usr/bin/env bash + echo "hello harbor arm build $(date)" + APP + chmod +x app.sh + cat > Dockerfile <<'DOCKER' + FROM alpine:3.20 + COPY app.sh /usr/local/bin/app.sh + RUN chmod +x /usr/local/bin/app.sh + ENTRYPOINT ["/usr/local/bin/app.sh"] + DOCKER + docker build -t $REGISTRY/$IMAGE:latest . + ''' + } + } + stage('Push image') { + steps { + withCredentials([usernamePassword(credentialsId: 'harbor-robot', usernameVariable: 'HUSER', passwordVariable: 'HPASS')]) { + sh ''' + echo "$HPASS" | docker login -u "$HUSER" --password-stdin $REGISTRY + docker push $REGISTRY/$IMAGE:latest + ''' + } + } + } + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..c64008a --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# harbor-arm-build +Proof-of-concept Jenkins pipeline: build a tiny image and push to Harbor.