forked from colin/resume
Update .woodpecker.yml
This commit is contained in:
parent
f8e7e58d26
commit
07ab5330b1
170
.woodpecker.yml
170
.woodpecker.yml
|
@ -1,144 +1,142 @@
|
||||||
labels:
|
labels:
|
||||||
hostname: "macmini7"
|
location: manager
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
git:
|
git:
|
||||||
image: woodpeckerci/plugin-git
|
image: woodpeckerci/plugin-git
|
||||||
settings:
|
settings:
|
||||||
partial: false
|
partial: false
|
||||||
depth: 1
|
depth: 1
|
||||||
|
recursive: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Build Step for staging Branch
|
# Build and Push for Staging
|
||||||
build-staging:
|
build-push-staging:
|
||||||
name: build-staging
|
name: build-push-staging
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
|
environment:
|
||||||
|
REGISTRY_USER:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
REGISTRY_PASSWORD:
|
||||||
|
from_secret: REGISTRY_PASSWORD
|
||||||
|
DOCKER_REGISTRY_USER:
|
||||||
|
from_secret: DOCKER_REGISTRY_USER
|
||||||
|
DOCKER_REGISTRY_PASSWORD:
|
||||||
|
from_secret: DOCKER_REGISTRY_PASSWORD
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
- echo "Building application for staging branch"
|
- echo "Logging into registries"
|
||||||
|
- echo "$${DOCKER_REGISTRY_PASSWORD}" | docker login -u "$${DOCKER_REGISTRY_USER}" --password-stdin
|
||||||
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
||||||
- echo compose build
|
- echo "Building and pushing application for staging"
|
||||||
- docker compose -f docker-compose.staging.yml build
|
- docker compose -f docker-compose.staging.yml build --no-cache
|
||||||
|
- docker compose -f docker-compose.staging.yml push
|
||||||
when:
|
when:
|
||||||
branch: main
|
branch: main
|
||||||
event: push
|
event: push
|
||||||
# path:
|
|
||||||
# include: [ 'stack.production.yml', 'stack.staging.yml', 'docker-compose.staging.yml', 'docker-compose.production.yml', 'Dockerfile', '*.tests.ts' ]
|
|
||||||
|
|
||||||
deploy-new:
|
# Deploy Staging
|
||||||
name: deploy-new
|
deploy-staging:
|
||||||
when:
|
name: deploy-staging
|
||||||
branch: main
|
|
||||||
# path:
|
|
||||||
# include: [ 'stack.production.yml', 'stack.staging.yml', 'docker-compose.staging.yml', 'docker-compose.production.yml', 'Dockerfile', '*.tests.ts' ]
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
|
environment:
|
||||||
|
REGISTRY_USER:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
REGISTRY_PASSWORD:
|
||||||
|
from_secret: REGISTRY_PASSWORD
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
|
- echo "Deploying to staging environment"
|
||||||
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
||||||
- echo compose push
|
|
||||||
- docker compose -f docker-compose.staging.yml push
|
|
||||||
- docker stack deploy --with-registry-auth -c ./stack.staging.yml $${CI_REPO_NAME}-staging
|
- docker stack deploy --with-registry-auth -c ./stack.staging.yml $${CI_REPO_NAME}-staging
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
event: push
|
||||||
|
|
||||||
# # Wait for Deploy to Complete
|
# Cleanup Staging
|
||||||
# wait-for-deploy-staging:
|
|
||||||
# name: wait-for-deploy-staging
|
|
||||||
# image: woodpeckerci/plugin-git
|
|
||||||
# commands:
|
|
||||||
# - echo "Waiting for staging deploy step to complete rollout."
|
|
||||||
# - sleep 60
|
|
||||||
# when:
|
|
||||||
# - branch: main
|
|
||||||
# - event: push
|
|
||||||
|
|
||||||
# # Run Automated Tests on staging Branch
|
|
||||||
# test-staging:
|
|
||||||
# name: run-tests-staging
|
|
||||||
# image: git.nixc.us/colin/playwright:latest
|
|
||||||
# secrets: [ base_url ]
|
|
||||||
# when:
|
|
||||||
# - branch: main
|
|
||||||
# - event: push
|
|
||||||
# - path:
|
|
||||||
# include: [ 'tests/', 'src/','docker-compose.staging.yml', 'docker-compose.production.yml', '*.tests.ts' ] # Specify paths relevant to tests
|
|
||||||
# volumes:
|
|
||||||
# - /var/run/docker.sock:/var/run/docker.sock:ro
|
|
||||||
|
|
||||||
cleanup-staging:
|
cleanup-staging:
|
||||||
name: cleanup-staging
|
name: cleanup-staging
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
# path:
|
|
||||||
# include: [ 'stack.production.yml', 'stack.staging.yml', 'docker-compose.staging.yml', 'docker-compose.production.yml', 'Dockerfile', '*.tests.ts' ]
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
|
environment:
|
||||||
|
REGISTRY_USER:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
REGISTRY_PASSWORD:
|
||||||
|
from_secret: REGISTRY_PASSWORD
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
# - docker stack rm $${CI_REPO_NAME}-staging
|
- echo "Cleaning up staging environment"
|
||||||
## added fault tolerance for docker stack rm
|
|
||||||
- for i in {1..5}; do docker stack rm ${CI_REPO_NAME}-staging && break || sleep 10; done
|
- for i in {1..5}; do docker stack rm ${CI_REPO_NAME}-staging && break || sleep 10; done
|
||||||
- docker compose -f docker-compose.staging.yml down
|
- docker compose -f docker-compose.staging.yml down
|
||||||
- docker compose -f docker-compose.staging.yml rm -f
|
- docker compose -f docker-compose.staging.yml rm -f
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
event: push
|
||||||
|
|
||||||
# Build Step for staging Branch
|
# Build and Push for Production
|
||||||
build-build-push-production:
|
build-push-production:
|
||||||
name: build-build-push-production
|
name: build-push-production
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
|
environment:
|
||||||
|
REGISTRY_USER:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
REGISTRY_PASSWORD:
|
||||||
|
from_secret: REGISTRY_PASSWORD
|
||||||
|
DOCKER_REGISTRY_USER:
|
||||||
|
from_secret: DOCKER_REGISTRY_USER
|
||||||
|
DOCKER_REGISTRY_PASSWORD:
|
||||||
|
from_secret: DOCKER_REGISTRY_PASSWORD
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
- echo "Building application for staging branch"
|
- echo "Logging into registries"
|
||||||
|
- echo "$${DOCKER_REGISTRY_PASSWORD}" | docker login -u "$${DOCKER_REGISTRY_USER}" --password-stdin
|
||||||
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
||||||
- echo compose build
|
- echo "Building and pushing application for production"
|
||||||
- docker compose -f docker-compose.production.yml build --no-cache
|
- docker compose -f docker-compose.production.yml build --no-cache
|
||||||
- docker compose -f docker-compose.production.yml push
|
- docker compose -f docker-compose.production.yml push
|
||||||
when:
|
when:
|
||||||
branch: main
|
branch: main
|
||||||
event: [push, cron]
|
event: [push, cron]
|
||||||
# path:
|
|
||||||
# include: [ 'stack.production.yml', 'stack.staging.yml', 'docker-compose.staging.yml', 'docker-compose.production.yml', 'Dockerfile', '*.tests.ts' ]
|
|
||||||
|
|
||||||
# Deploy to Production Branch
|
# Deploy Production
|
||||||
deploy-production:
|
deploy-production:
|
||||||
name: deploy-production
|
name: deploy-production
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
|
environment:
|
||||||
|
REGISTRY_USER:
|
||||||
|
from_secret: REGISTRY_USER
|
||||||
|
REGISTRY_PASSWORD:
|
||||||
|
from_secret: REGISTRY_PASSWORD
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
|
- echo "Deploying to production environment"
|
||||||
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
- echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
|
||||||
- docker stack deploy --with-registry-auth -c ./stack.production.yml $${CI_REPO_NAME}
|
- docker stack deploy --with-registry-auth -c ./stack.production.yml $${CI_REPO_NAME}
|
||||||
# - docker image rm git.nixc.us/colin/$${CI_REPO_NAME}:production
|
|
||||||
when:
|
when:
|
||||||
branch: main
|
branch: main
|
||||||
event: [push, cron]
|
event: [push, cron]
|
||||||
# path:
|
|
||||||
# include: [ 'stack.production.yml', 'stack.staging.yml', 'docker-compose.staging.yml', 'docker-compose.production.yml', 'Dockerfile', '*.tests.ts' ]
|
|
||||||
|
|
||||||
|
# Wait for Deploy Completion
|
||||||
|
wait-for-deploy-production:
|
||||||
|
name: wait-for-deploy-production
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
commands:
|
||||||
|
- echo "Waiting for deploy step to complete rollout."
|
||||||
|
- sleep 60
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
event: push
|
||||||
|
|
||||||
# # Wait for Deploy to Complete
|
# Post-Deployment Smoke Tests
|
||||||
# wait-for-deploy-production:
|
post-deploy-smoke-tests-git-nixc-us:
|
||||||
# name: wait-for-deploy-production
|
name: run-post-deploy-smoke-tests-git-nixc-us
|
||||||
# image: woodpeckerci/plugin-git
|
image: codeberg.org/nixius/playwright:latest
|
||||||
# commands:
|
environment:
|
||||||
# - echo "Waiting for deploy step to complete rollout."
|
BASE_URL: "https://git.nixc.us"
|
||||||
# - sleep 60
|
when:
|
||||||
# when:
|
branch: main
|
||||||
# branch: main
|
event: push
|
||||||
# event: push
|
|
||||||
|
|
||||||
# # Run Post-Deployment Smoke Tests
|
|
||||||
# post-deploy-smoke-tests-git-nixc-us:
|
|
||||||
# name: run-post-deploy-smoke-tests-git-nixc-us
|
|
||||||
# image: git.nixc.us/colin/playwright:latest
|
|
||||||
# # secrets: [TEST_USER, TEST_PASSWORD]
|
|
||||||
# environment:
|
|
||||||
# - BASE_URL=https://git.nixc.us
|
|
||||||
# when:
|
|
||||||
# branch: main
|
|
||||||
# event: push
|
|
||||||
# # path:
|
|
||||||
# # include: [ 'stack.production.yml', 'stack.staging.yml', 'docker-compose.staging.yml', 'docker-compose.production.yml', 'Dockerfile', '*.tests.ts' ]
|
|
||||||
|
|
Loading…
Reference in New Issue