2021-10-30 16:27:49 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
|
|
|
name: default
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
limit: 1
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
|
|
|
|
steps:
|
2021-11-14 17:25:12 -05:00
|
|
|
- name: replace hosts and user variables
|
|
|
|
image: ubuntu:impish
|
|
|
|
environment:
|
|
|
|
SPT_ITEMS_HOSTNAME:
|
|
|
|
from_secret: spt_items_hostname
|
|
|
|
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:
|
|
|
|
- sed -i 's/{{ SPT_ITEMS_HOSTNAME }}/'"$SPT_ITEMS_HOSTNAME"'/g' ./items/frontend/.env.example
|
|
|
|
- mv ./items/frontend/.env.example ./items/frontend/.env
|
|
|
|
- echo "$DEPLOY_PRIVATE_KEY" > private.key && chmod 600 private.key
|
|
|
|
- sed -i 's/{{ DEPLOY_HOSTNAME }}/'"$DEPLOY_HOSTNAME"'/g' ./.ansible-items/inventory
|
|
|
|
- sed -i 's/{{ DEPLOY_SSH_KEY_PASSPHRASE }}/'"$DEPLOY_SSH_KEY_PASSPHRASE"'/g' ./.ansible-items/inventory
|
|
|
|
- sed -i 's/{{ DEPLOY_USER }}/'"$DEPLOY_USER"'/g' ./.ansible-items/inventory
|
2021-10-30 16:27:49 +00:00
|
|
|
|
2021-11-14 17:25:12 -05:00
|
|
|
- name: install frontend dependencies
|
|
|
|
image: node:lts-alpine3.14
|
|
|
|
commands:
|
|
|
|
- node -v
|
|
|
|
- npm -v
|
|
|
|
- yarn --version
|
|
|
|
- yarn --cwd ./items/frontend install
|
|
|
|
depends_on:
|
|
|
|
- replace hosts and user variables
|
2021-10-30 16:27:49 +00:00
|
|
|
|
2021-11-14 17:25:12 -05:00
|
|
|
- name: frontend
|
|
|
|
image: node:lts-alpine3.14
|
|
|
|
commands:
|
|
|
|
- node -v
|
|
|
|
- npm -v
|
|
|
|
- yarn --version
|
|
|
|
- yarn --cwd ./items/frontend start
|
|
|
|
detach: true
|
|
|
|
depends_on:
|
|
|
|
- install frontend dependencies
|
2021-11-14 14:39:07 -05:00
|
|
|
|
2021-11-14 17:25:12 -05:00
|
|
|
- name: test frontend
|
|
|
|
image: cypress/browsers:node16.5.0-chrome94-ff93
|
|
|
|
commands:
|
|
|
|
- node -v
|
|
|
|
- npm -v
|
|
|
|
- yarn --version
|
|
|
|
- yarn --cwd ./items/frontend cy:run
|
|
|
|
depends_on:
|
|
|
|
- install frontend dependencies
|
2021-11-14 14:39:07 -05:00
|
|
|
|
2021-11-14 17:25:12 -05:00
|
|
|
- name: build frontend
|
|
|
|
image: node:lts-alpine3.14
|
|
|
|
commands:
|
|
|
|
- node -v
|
|
|
|
- npm -v
|
|
|
|
- yarn --version
|
|
|
|
- yarn --cwd ./items/frontend build --pure-lockfile
|
|
|
|
- rm -rf ./items/api/public/static/*
|
|
|
|
- mv ./items/frontend/build/* ./items/api/public
|
|
|
|
- rm ./items/api/public/index.html
|
|
|
|
depends_on:
|
|
|
|
- test frontend
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- main
|
|
|
|
- master
|
|
|
|
- development
|
2021-11-04 01:21:44 +00:00
|
|
|
|
2021-11-14 17:25:12 -05:00
|
|
|
- name: check ansible syntax
|
|
|
|
image: plugins/ansible:3
|
|
|
|
settings:
|
|
|
|
playbook: ./.ansible-items/playbook.yml
|
|
|
|
inventory: ./.ansible-items/inventory
|
|
|
|
galaxy: ./.ansible-items/requirements.yml
|
|
|
|
syntax_check: true
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- development
|
|
|
|
|
|
|
|
- name: apply ansible playbook
|
|
|
|
image: plugins/ansible:3
|
|
|
|
settings:
|
|
|
|
playbook: ./.ansible-items/playbook.yml
|
|
|
|
inventory: ./.ansible-items/inventory
|
|
|
|
galaxy: ./.ansible-items/requirements.yml
|
|
|
|
timeout: 60
|
|
|
|
verbose: 2
|
|
|
|
environment:
|
|
|
|
SPT_ITEMS_HOSTNAME:
|
|
|
|
from_secret: spt_items_hostname
|
|
|
|
DEPLOY_HOSTNAME:
|
|
|
|
from_secret: deploy_hostname
|
|
|
|
DEPLOY_USER:
|
|
|
|
from_secret: deploy_username
|
|
|
|
DEPLOY_USER_GROUP:
|
|
|
|
from_secret: deploy_user_group
|
|
|
|
SPT_ITEMS_PATH:
|
|
|
|
from_secret: deploy_path
|
|
|
|
depends_on:
|
|
|
|
- check ansible syntax
|
|
|
|
- build frontend
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- master
|
|
|
|
- main
|