with updated drone
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Kasper Juul Hermansen 2022-10-27 21:58:23 +02:00
parent e6b3321c2a
commit 467993dee3
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23

View File

@ -1,30 +1,36 @@
type: docker
kind: pipeline kind: pipeline
name: Serverctl name: Serverctl
steps: steps:
- name: terraform plan - name: test
image: alpine image: harbor.front.kjuulh.io/docker-proxy/library/bash:latest
environment:
HCLOUD_TOKEN:
from_secret: serverctl_hcloud_token
ACCESS_KEY:
from_secret: serverctl_access_key
SECRET_KEY:
from_secret: serverctl_secret_key
SSH_ZIP_KEY:
from_secret: serverctl_ssh_zip_key
HCLOUD_SSH_KEY_ID:
from_secret: serverctl_hcloud_ssh_key_id
commands: commands:
- apk --update add curl zip ansible python3 - echo 'Run tests'
- cd infrastructure && ./unzip-ssh-keys.sh "$SSH_ZIP_KEY" && cd .. #
- curl --silent --output terraform.zip "https://releases.hashicorp.com/terraform/1.1.6/terraform_1.1.6_linux_amd64.zip" # - name: terraform plan
- unzip terraform.zip ; rm -f terraform.zip; chmod +x terraform # image: alpine
- mkdir -p ${HOME}/bin ; export PATH=${PATH}:${HOME}/bin; mv terraform ${HOME}/bin/ # environment:
- terraform -v # HCLOUD_TOKEN:
- cd infrastructure/create-resources # from_secret: serverctl_hcloud_token
- terraform init -backend-config="access_key=$ACCESS_KEY" -backend-config="secret_key=$SECRET_KEY" # ACCESS_KEY:
- terraform validate # from_secret: serverctl_access_key
- terraform apply -auto-approve -var "hcloud_token=$HCLOUD_TOKEN" -var "pvt_key=../ssh_keys/id_ed25519" -var "pub_key=../ssh_keys/id_ed25519.pub" -var "hcloud_serverctl_ssh_key_id=$HCLOUD_SSH_KEY_ID" # SECRET_KEY:
- cd ansible # from_secret: serverctl_secret_key
- ANSIBLE_HOST_KEY_CHECKING=False /usr/bin/ansible-playbook -u root --key-file '../../ssh_keys/id_ed25519' -e 'pub_key=../../ssh_keys/id_ed25519.pub' site.yml # SSH_ZIP_KEY:
# from_secret: serverctl_ssh_zip_key
# HCLOUD_SSH_KEY_ID:
# from_secret: serverctl_hcloud_ssh_key_id
# commands:
# - apk --update add curl zip ansible python3
# - cd infrastructure && ./unzip-ssh-keys.sh "$SSH_ZIP_KEY" && cd ..
# - curl --silent --output terraform.zip "https://releases.hashicorp.com/terraform/1.1.6/terraform_1.1.6_linux_amd64.zip"
# - unzip terraform.zip ; rm -f terraform.zip; chmod +x terraform
# - mkdir -p ${HOME}/bin ; export PATH=${PATH}:${HOME}/bin; mv terraform ${HOME}/bin/
# - terraform -v
# - cd infrastructure/create-resources
# - terraform init -backend-config="access_key=$ACCESS_KEY" -backend-config="secret_key=$SECRET_KEY"
# - terraform validate
# - terraform apply -auto-approve -var "hcloud_token=$HCLOUD_TOKEN" -var "pvt_key=../ssh_keys/id_ed25519" -var "pub_key=../ssh_keys/id_ed25519.pub" -var "hcloud_serverctl_ssh_key_id=$HCLOUD_SSH_KEY_ID"
# - cd ansible
# - ANSIBLE_HOST_KEY_CHECKING=False /usr/bin/ansible-playbook -u root --key-file '../../ssh_keys/id_ed25519' -e 'pub_key=../../ssh_keys/id_ed25519.pub' site.yml