diff --git a/.woodpecker.yml b/.woodpecker.yml index 47563cb..d3ec6d7 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,3 +1,4 @@ +# build:0 labels: location: manager clone: @@ -7,10 +8,11 @@ clone: partial: false depth: 1 when: - branch: [main, master] + branch: [main] steps: - build: - name: build + # Build and Push + build-push: + name: build-push image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: @@ -20,14 +22,21 @@ steps: volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin registry.example.com - - docker build -t registry.example.com/ploughshares:latest -t registry.example.com/ploughshares:${CI_COMMIT_BRANCH} -f docker/ploughshares/Dockerfile . - - docker push registry.example.com/ploughshares:latest - - docker push registry.example.com/ploughshares:${CI_COMMIT_BRANCH} + - echo "nameserver 1.1.1.1" > /etc/resolv.conf + - echo "nameserver 1.0.0.1" >> /etc/resolv.conf + - HOSTNAME=$(docker info --format "{{.Name}}") + - echo "Building on $HOSTNAME" + - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us + - export PLOUGHSHARES_VERSION=$(cat VERSION | tr -d '\n') + - echo "Building version $${PLOUGHSHARES_VERSION}" + - docker build -t git.nixc.us/colin/ploughshares:latest -t git.nixc.us/colin/ploughshares:$${PLOUGHSHARES_VERSION} -f docker/ploughshares/Dockerfile . + - docker push git.nixc.us/colin/ploughshares:latest + - docker push git.nixc.us/colin/ploughshares:$${PLOUGHSHARES_VERSION} when: - event: [push, tag] - branch: [main, master] + branch: main + event: [push] + # Deploy Production deploy: name: deploy image: woodpeckerci/plugin-docker-buildx @@ -39,26 +48,12 @@ steps: volumes: - /var/run/docker.sock:/var/run/docker.sock commands: + - echo "nameserver 1.1.1.1" > /etc/resolv.conf + - echo "nameserver 1.0.0.1" >> /etc/resolv.conf + - HOSTNAME=$(docker info --format "{{.Name}}") + - echo "Deploying on $HOSTNAME" - 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 ploughshares when: - event: [push, tag] - branch: [main, master] - - notify: - name: notify - image: plugins/slack - settings: - webhook: - from_secret: slack_webhook - channel: deployments - template: > - {{#success build.status}} - Build {{build.number}} succeeded. Project Ploughshares has been deployed successfully. - {{else}} - Build {{build.number}} failed. Please check the logs for more details. - {{/success}} - when: - status: [success, failure] - event: [push, tag] - branch: [main, master] \ No newline at end of file + branch: main + event: [push] \ No newline at end of file