Add more parameters for deploy template.
This commit is contained in:
parent
a1a845cd62
commit
af1eef10ed
|
@ -2,10 +2,11 @@ on:
|
|||
workflow_call:
|
||||
inputs:
|
||||
stand_name:
|
||||
description: 'Stand name, has influence on addresses and settings.'
|
||||
description: 'Общее наименование стенда'
|
||||
required: true
|
||||
type: string
|
||||
kube_namespace:
|
||||
description: 'Местоположение для деплоя в кластере'
|
||||
required: true
|
||||
type: string
|
||||
docker_repo_path:
|
||||
|
@ -13,6 +14,11 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
docker_images_path:
|
||||
description: 'Относительный путь для образов проекта'
|
||||
required: true
|
||||
type: string
|
||||
vault_secrets_base_path:
|
||||
description: 'Базовый путь для секретов проекта в vault'
|
||||
required: true
|
||||
type: string
|
||||
has_secrets:
|
||||
|
@ -20,7 +26,19 @@ on:
|
|||
required: false
|
||||
type: boolean
|
||||
werf_secret_key_vault_location:
|
||||
required: true
|
||||
description: "Имя секрета, содержащего ключ для дешифрования werf, расположенного по базовому пути в vault"
|
||||
default: werf_secret_key
|
||||
required: false
|
||||
type: string
|
||||
notification_enabled:
|
||||
description: "Включение оповещений о разворачивании, требуется иметь url для оповещений в vault"
|
||||
default: true
|
||||
required: false
|
||||
type: boolean
|
||||
notification_channel:
|
||||
description: "Канал для оповещений о результатах деплоя"
|
||||
default: internal_projects_notifications
|
||||
required: false
|
||||
type: string
|
||||
werf_debug:
|
||||
default: false
|
||||
|
@ -32,8 +50,6 @@ on:
|
|||
VAULT_SECRET_ID:
|
||||
required: true
|
||||
|
||||
# FIXME Убрать хардкод для токена оповещений и канала оповещений
|
||||
|
||||
jobs:
|
||||
converge:
|
||||
name: Deploy stand
|
||||
|
@ -45,6 +61,7 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# FIXME Эти секреты нужно будет сделать полностью различными для проектов, идеально - краткосрочные генерируемые vault
|
||||
- id: import-secrets
|
||||
uses: https://github.com/hashicorp/vault-action@v2
|
||||
with:
|
||||
|
@ -56,7 +73,6 @@ jobs:
|
|||
dev/wilix/main/data/ci local_cluster_kube_config_base64 ;
|
||||
dev/wilix/main/data/ci docker_registry_username ;
|
||||
dev/wilix/main/data/ci docker_registry_password ;
|
||||
dev/wilix/loop/data/ci/loop-vizor notification_url | MATTERMOST_WEBHOOK_URL ;
|
||||
|
||||
- name: Login to nexus docker
|
||||
uses: https://github.com/docker/login-action@v2
|
||||
|
@ -73,7 +89,7 @@ jobs:
|
|||
werf helm repo add wilix-dysnix https://artifacts.wilix.dev/repository/helm-dysnix
|
||||
werf helm repo add wilix-bitnami https://artifacts.wilix.dev/repository/helm-bitnami
|
||||
|
||||
- name: Get werf secret key if needed
|
||||
- name: Get werf secret key if need
|
||||
if: ${{ inputs.has_secrets }}
|
||||
uses: https://github.com/hashicorp/vault-action@v2
|
||||
with:
|
||||
|
@ -82,7 +98,7 @@ jobs:
|
|||
roleId: ${{ secrets.VAULT_ROLE_ID }}
|
||||
secretId: ${{ secrets.VAULT_SECRET_ID }}
|
||||
secrets: |
|
||||
${{ inputs.werf_secret_key_vault_location }} | WERF_SECRET_KEY ;
|
||||
${{ inputs.vault_secrets_base_path }} ${{ inputs.werf_secret_key_vault_location }} | WERF_SECRET_KEY ;
|
||||
|
||||
- name: Setup secrets if need
|
||||
if: ${{ inputs.has_secrets }}
|
||||
|
@ -101,13 +117,25 @@ jobs:
|
|||
WERF_REPO: ${{ inputs.docker_repo_path }}/${{ inputs.docker_images_path }}
|
||||
WERF_KUBECONFIG_BASE64: ${{ steps.import-secrets.outputs.local_cluster_kube_config_base64 }}
|
||||
|
||||
- name: Get notification url
|
||||
if: ${{ inputs.notification_enabled }}
|
||||
uses: https://github.com/hashicorp/vault-action@v2
|
||||
with:
|
||||
url: https://vault.wilix.dev
|
||||
method: approle
|
||||
roleId: ${{ secrets.VAULT_ROLE_ID }}
|
||||
secretId: ${{ secrets.VAULT_SECRET_ID }}
|
||||
secrets: |
|
||||
${{ inputs.vault_secrets_base_path }} notification_url | MATTERMOST_WEBHOOK_URL ;
|
||||
|
||||
- name: prepare success notification body
|
||||
uses: https://github.com/finnp/create-file-action@master
|
||||
if: ${{ inputs.notification_enabled }}
|
||||
env:
|
||||
FILE_NAME: "mattermost.json"
|
||||
FILE_DATA: |
|
||||
{
|
||||
"channel": "project_loop_notifications",
|
||||
"channel": "${{ inputs.notification_channel }}",
|
||||
"attachments": [
|
||||
{
|
||||
"fallback": "Деплой прошел успешно для ${{ gitea.repository }}",
|
||||
|
@ -126,12 +154,12 @@ jobs:
|
|||
|
||||
- name: prepare failed notification body
|
||||
uses: https://github.com/finnp/create-file-action@master
|
||||
if: failure()
|
||||
if: ${{ inputs.notification_enabled && failure() }}
|
||||
env:
|
||||
FILE_NAME: "mattermost.json"
|
||||
FILE_DATA: |
|
||||
{
|
||||
"channel": "project_loop_notifications",
|
||||
"channel": "${{ inputs.notification_channel }}",
|
||||
"attachments": [
|
||||
{
|
||||
"fallback": "Деплой упал для ${{ gitea.repository }}",
|
||||
|
@ -150,4 +178,4 @@ jobs:
|
|||
|
||||
- name: loop fail notification
|
||||
uses: https://github.com/mattermost/action-mattermost-notify@master
|
||||
if: ${{ job.status == 'success' || job.status == 'failure' }}
|
||||
if: ${{ inputs.notification_enabled && (job.status == 'success' || job.status == 'failure') }}
|
||||
|
|
Loading…
Reference in New Issue