# Woodpecker CI/CD Pipeline - Peikarband Landing # Simple and efficient pipeline variables: - &helm_image 'alpine/helm:latest' when: - event: [push, pull_request, tag, manual] pipeline: # ============================================ # Build Application Image (with fallback to python base) # ============================================ build-and-push-app: image: woodpeckerci/plugin-docker-buildx settings: registry: hub.peikarband.ir repo: hub.peikarband.ir/peikarband/landing username: from_secret: HARBOR_USERNAME password: from_secret: HARBOR_PASSWORD dockerfile: docker/Dockerfile context: . platforms: linux/amd64 build_args: - BASE_IMAGE=hub.peikarband.ir/peikarband/base:latest - VERSION=${CI_COMMIT_SHA:0:8} - BUILD_DATE=${CI_PIPELINE_CREATED} tags: - latest - ${CI_COMMIT_SHA:0:8} - ${CI_COMMIT_BRANCH} labels: - org.opencontainers.image.created=${CI_PIPELINE_CREATED} - org.opencontainers.image.source=${CI_REPO_LINK} - org.opencontainers.image.url=${CI_REPO_LINK} - org.opencontainers.image.revision=${CI_COMMIT_SHA} - org.opencontainers.image.version=${CI_COMMIT_SHA:0:8} - org.opencontainers.image.title=Peikarband Landing - org.opencontainers.image.description=Peikarband hosting platform landing page pull: true provenance: false push: true when: event: [push, tag] branch: [main, develop, feature/restructure-project] # ============================================ # Verify Push # ============================================ verify-push: image: alpine:latest commands: - apk add --no-cache curl - | echo "Verifying image was pushed successfully..." sleep 3 REGISTRY="hub.peikarband.ir" REPO="peikarband/landing" TAG="${CI_COMMIT_SHA:0:8}" if curl -f -u "$HARBOR_USERNAME:$HARBOR_PASSWORD" \ "https://$REGISTRY/v2/$REPO/manifests/$TAG" > /dev/null 2>&1; then echo "✅ Image verified: $REGISTRY/$REPO:$TAG" echo "" echo "Available tags:" echo " - latest" echo " - ${CI_COMMIT_SHA:0:8}" echo " - ${CI_COMMIT_BRANCH}" else echo "❌ Failed to verify image push" exit 1 fi secrets: [HARBOR_USERNAME, HARBOR_PASSWORD] when: event: [push, tag] branch: [main, develop, feature/restructure-project] # ============================================ # Notifications # ============================================ notify-success: image: alpine:latest commands: - echo "════════════════════════════════════════" - echo " 🎉 Pipeline Completed Successfully!" - echo "════════════════════════════════════════" - echo "" - echo "Branch:" "${CI_COMMIT_BRANCH}" - echo "Commit:" "${CI_COMMIT_SHA:0:8}" - echo "Image:" "hub.peikarband.ir/peikarband/landing:${CI_COMMIT_SHA:0:8}" - echo "" - echo "════════════════════════════════════════" when: event: [push, tag] status: success notify-failure: image: alpine:latest commands: - echo "════════════════════════════════════════" - echo " ❌ Pipeline Failed!" - echo "════════════════════════════════════════" - echo "" - echo "Branch:" "${CI_COMMIT_BRANCH}" - echo "Commit:" "${CI_COMMIT_SHA:0:8}" - echo "" - echo "Please check the logs above" - echo "════════════════════════════════════════" when: event: [push, tag] status: failure