2023-03-02 21:11:58 -05:00
|
|
|
kind: pipeline
|
2023-03-02 21:25:05 -05:00
|
|
|
type: docker
|
|
|
|
name: website deployment
|
2023-03-02 21:11:58 -05:00
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
2023-03-02 21:25:05 -05:00
|
|
|
- pull_request
|
2023-03-02 21:11:58 -05:00
|
|
|
|
|
|
|
steps:
|
2023-03-02 21:12:46 -05:00
|
|
|
- name: replace hosts and user variables
|
|
|
|
image: ubuntu:impish
|
|
|
|
environment:
|
|
|
|
DEPLOY_HOSTNAME:
|
|
|
|
from_secret: deploy_hostname
|
|
|
|
DEPLOY_USER:
|
|
|
|
from_secret: deploy_username
|
|
|
|
DEPLOY_PRIVATE_KEY:
|
|
|
|
from_secret: deploy_ssh_key
|
|
|
|
DEPLOY_SSH_KEY_PASSPHRASE:
|
|
|
|
from_secret: deploy_ssh_key_passphrase
|
|
|
|
commands:
|
|
|
|
- echo "$DEPLOY_PRIVATE_KEY" > private.key && chmod 600 private.key
|
2023-03-02 21:25:05 -05:00
|
|
|
- sed -i 's/{{ DEPLOY_HOSTNAME }}/'"$DEPLOY_HOSTNAME"'/g' ./.ansible/inventory
|
|
|
|
- sed -i 's/{{ DEPLOY_SSH_KEY_PASSPHRASE }}/'"$DEPLOY_SSH_KEY_PASSPHRASE"'/g' ./.ansible/inventory
|
|
|
|
- sed -i 's/{{ DEPLOY_USER }}/'"$DEPLOY_USER"'/g' ./.ansible/inventory
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- master
|
|
|
|
- development
|
|
|
|
- main
|
|
|
|
- develop
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
2023-03-02 21:11:58 -05:00
|
|
|
|
2023-03-02 21:25:05 -05:00
|
|
|
- name: check website ansible syntax
|
|
|
|
image: plugins/ansible:3
|
|
|
|
settings:
|
|
|
|
playbook: ./.ansible/playbook.yml
|
|
|
|
inventory: ./.ansible/inventory
|
|
|
|
syntax_check: true
|
2023-03-02 21:12:46 -05:00
|
|
|
depends_on:
|
|
|
|
- replace hosts and user variables
|
2023-03-02 21:25:05 -05:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- master
|
|
|
|
- development
|
|
|
|
- main
|
|
|
|
- develop
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
2023-03-02 21:11:58 -05:00
|
|
|
|
2023-03-02 21:25:05 -05:00
|
|
|
- name: dry-run ansible playbook website
|
2023-03-02 21:12:46 -05:00
|
|
|
image: plugins/ansible:3
|
|
|
|
settings:
|
2023-03-02 21:25:05 -05:00
|
|
|
playbook: ./.ansible/playbook.yml
|
|
|
|
inventory: ./.ansible/inventory
|
|
|
|
timeout: 60
|
|
|
|
verbose: 2
|
|
|
|
check: true
|
|
|
|
environment:
|
|
|
|
DEPLOY_HOSTNAME:
|
|
|
|
from_secret: deploy_hostname
|
|
|
|
DEPLOY_USER:
|
|
|
|
from_secret: deploy_username
|
|
|
|
DEPLOY_USER_GROUP:
|
|
|
|
from_secret: deploy_user_group
|
|
|
|
SPT_WEBSITE_PATH:
|
|
|
|
from_secret: website_deploy_path
|
|
|
|
depends_on:
|
|
|
|
- check website ansible syntax
|
2023-03-02 21:12:46 -05:00
|
|
|
when:
|
|
|
|
branch:
|
2023-03-02 21:25:05 -05:00
|
|
|
- master
|
2023-03-02 21:12:46 -05:00
|
|
|
- development
|
2023-03-02 21:25:05 -05:00
|
|
|
- main
|
|
|
|
- develop
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
2023-03-02 21:12:46 -05:00
|
|
|
|
2023-03-02 21:25:05 -05:00
|
|
|
- name: apply ansible playbook website
|
2023-03-02 21:12:46 -05:00
|
|
|
image: plugins/ansible:3
|
|
|
|
settings:
|
2023-03-02 21:25:05 -05:00
|
|
|
playbook: ./.ansible/playbook.yml
|
|
|
|
inventory: ./.ansible/inventory
|
2023-03-02 21:12:46 -05:00
|
|
|
timeout: 60
|
|
|
|
verbose: 2
|
|
|
|
environment:
|
|
|
|
DEPLOY_HOSTNAME:
|
|
|
|
from_secret: deploy_hostname
|
|
|
|
DEPLOY_USER:
|
|
|
|
from_secret: deploy_username
|
|
|
|
DEPLOY_USER_GROUP:
|
|
|
|
from_secret: deploy_user_group
|
2023-03-02 21:25:05 -05:00
|
|
|
SPT_WEBSITE_PATH:
|
|
|
|
from_secret: website_deploy_path
|
2023-03-02 21:12:46 -05:00
|
|
|
depends_on:
|
2023-03-02 21:25:05 -05:00
|
|
|
- check website ansible syntax
|
2023-03-02 21:12:46 -05:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- master
|
2023-03-02 21:25:05 -05:00
|
|
|
- main
|
|
|
|
event:
|
|
|
|
- push
|