Update .woodpecker.yml
This commit is contained in:
		
							parent
							
								
									8c28d3c2f0
								
							
						
					
					
						commit
						84e3ca0bfc
					
				
							
								
								
									
										152
									
								
								.woodpecker.yml
								
								
								
								
							
							
						
						
									
										152
									
								
								.woodpecker.yml
								
								
								
								
							| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
# woodpecker.yml
 | 
			
		||||
labels:
 | 
			
		||||
  hostname: "macmini7"
 | 
			
		||||
clone:
 | 
			
		||||
| 
						 | 
				
			
			@ -8,37 +7,138 @@ clone:
 | 
			
		|||
      partial: false
 | 
			
		||||
      depth: 1
 | 
			
		||||
steps:
 | 
			
		||||
  # run-smoke-tests:
 | 
			
		||||
  #   name: run-playwright-tests
 | 
			
		||||
  #   image: git.nixc.us/colin/playwright:latest
 | 
			
		||||
  #   secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
  #   when:
 | 
			
		||||
  #     - branch: main
 | 
			
		||||
  #     - path:
 | 
			
		||||
  #         include: [ 'stack.yml', 'docker-compose.yml', 'Dockerfile', '.woodpecker.yml', '*.tests.ts' ]
 | 
			
		||||
  deploy-config:
 | 
			
		||||
    name: deploy-config
 | 
			
		||||
    when:
 | 
			
		||||
      - path:
 | 
			
		||||
          include: [ 'stack.yml', 'Dockerfile', '.woodpecker.yml', 'README.md']
 | 
			
		||||
  # Build Step for staging Branch
 | 
			
		||||
  build-staging:
 | 
			
		||||
    name: build-staging
 | 
			
		||||
    image: woodpeckerci/plugin-docker-buildx
 | 
			
		||||
    # secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
    secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/run/docker.sock:/var/run/docker.sock
 | 
			
		||||
    commands:
 | 
			
		||||
    #   - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
 | 
			
		||||
      - docker stack deploy --with-registry-auth -c ./stack.yml $${CI_REPO_NAME}
 | 
			
		||||
  # wait:
 | 
			
		||||
  #   # image: alpine
 | 
			
		||||
      - echo "Building application for staging branch"
 | 
			
		||||
      - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
 | 
			
		||||
      - echo compose build
 | 
			
		||||
      - docker compose -f docker-compose.staging.yml build
 | 
			
		||||
    when:
 | 
			
		||||
      branch: main
 | 
			
		||||
      event: push
 | 
			
		||||
      # path:
 | 
			
		||||
      #     include: [ 'stack.production.yml', 'stack.staging.yml', 'docker-compose.staging.yml', 'docker-compose.production.yml', 'Dockerfile', '*.tests.ts' ]
 | 
			
		||||
 | 
			
		||||
  deploy-new:
 | 
			
		||||
    name: deploy-new
 | 
			
		||||
    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
 | 
			
		||||
    secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/run/docker.sock:/var/run/docker.sock
 | 
			
		||||
    commands:
 | 
			
		||||
      - 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
 | 
			
		||||
 | 
			
		||||
  # # Wait for Deploy to Complete
 | 
			
		||||
  # wait-for-deploy-staging:
 | 
			
		||||
  #   name: wait-for-deploy-staging
 | 
			
		||||
  #   image: woodpeckerci/plugin-git
 | 
			
		||||
  #   commands:
 | 
			
		||||
  #     - echo "Waiting for five minutes"
 | 
			
		||||
  #     - sleep 300  # Waits for five minutes
 | 
			
		||||
  # run-post-deploy-smoke-tests:
 | 
			
		||||
  #   name: run-post-deploy-smoke-tests
 | 
			
		||||
  #   image: git.nixc.us/colin/playwright:latest
 | 
			
		||||
  #   secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
  #     - 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: [ 'stack.yml', 'docker-compose.yml', 'Dockerfile', '.woodpecker.yml', '*.tests.ts' ]
 | 
			
		||||
  #         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:
 | 
			
		||||
    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
 | 
			
		||||
    secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/run/docker.sock:/var/run/docker.sock
 | 
			
		||||
    commands:
 | 
			
		||||
      # - docker stack rm $${CI_REPO_NAME}-staging 
 | 
			
		||||
      ## added fault tolerance for docker stack rm
 | 
			
		||||
      - 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 rm -f
 | 
			
		||||
 | 
			
		||||
  # Build Step for staging Branch
 | 
			
		||||
  build-build-push-production:
 | 
			
		||||
    name: build-build-push-production
 | 
			
		||||
    image: woodpeckerci/plugin-docker-buildx
 | 
			
		||||
    secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/run/docker.sock:/var/run/docker.sock
 | 
			
		||||
    commands:
 | 
			
		||||
      - echo "Building application for staging branch"
 | 
			
		||||
      - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us
 | 
			
		||||
      - echo compose build
 | 
			
		||||
      - docker compose -f docker-compose.production.yml build --no-cache
 | 
			
		||||
      - docker compose -f docker-compose.production.yml push
 | 
			
		||||
    when:
 | 
			
		||||
      branch: main
 | 
			
		||||
      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:
 | 
			
		||||
    name: deploy-production
 | 
			
		||||
    image: woodpeckerci/plugin-docker-buildx
 | 
			
		||||
    secrets: [REGISTRY_USER, REGISTRY_PASSWORD]
 | 
			
		||||
    volumes:
 | 
			
		||||
      - /var/run/docker.sock:/var/run/docker.sock
 | 
			
		||||
    commands:
 | 
			
		||||
      - 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 image rm git.nixc.us/colin/$${CI_REPO_NAME}:production
 | 
			
		||||
    when:
 | 
			
		||||
      branch: main
 | 
			
		||||
      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 to Complete
 | 
			
		||||
  # 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
 | 
			
		||||
 | 
			
		||||
  # # 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