woodpecker: refactor pipeline

Ariadne Conill 2022-06-09 02:45:38 +00:00
parent 62e7672b08
commit 261ce93daa
1 changed files with 12 additions and 13 deletions

View File

@ -1,6 +1,6 @@
pipeline: pipeline:
validate: validate:
image: alpine image: alpine:3.16
when: when:
path: "dns/**" path: "dns/**"
event: pull_request event: pull_request
@ -9,25 +9,24 @@ pipeline:
commands: commands:
- apk add --no-cache terraform - apk add --no-cache terraform
- terraform version - terraform version
- | - cd dns
cd dns - terraform init
echo 'token = "$${LINODE_TOKEN}"' > .auto.tfvars - terraform validate
terraform validate - terraform plan -var "token=$LINODE_TOKEN"
terraform plan
deploy: deploy:
image: alpine image: alpine:3.16
when: when:
path: "dns/**" path: "dns/**"
branch: main
event: push event: push
secrets: secrets:
- linode_token - linode_token
commands: commands:
- apk add --no-cache terraform - apk add --no-cache terraform
- terraform version - terraform version
- | - cd dns
cd dns - terraform init
echo 'token = "$${LINODE_TOKEN}"' > .auto.tfvars - terraform validate
terraform validate - terraform plan -out deploy.plan -var "token=$LINODE_TOKEN"
terraform plan -out deploy.plan - terraform apply deploy.plan -var "token=$LINODE_TOKEN"
terraform apply deploy.plan