Compare commits

..

37 Commits

Author SHA1 Message Date
c23b92dcc5 Merge pull request 'Add loop-channel-export plugin action' (#14) from loop-plugin-channel-export-template into master
Reviewed-on: #14
2025-10-23 10:56:45 +00:00
d105b24d3d Add loop-channel-export plugin action 2025-10-23 13:54:06 +03:00
dd556a3bd1 Merge pull request 'Add loop-mobile PR ci test.' (#13) from Loop-mobile-ci-test into master
Reviewed-on: #13
2025-10-13 05:53:53 +00:00
b563bfff21 Add loop-mobile PR ci test. 2025-10-13 08:52:26 +03:00
3c5c77baf6 Merge pull request 'Update-marketplace-template' (#12) from Update-marketplace-template into master
Reviewed-on: #12
2025-09-16 06:21:49 +00:00
dde9b7de25 Fix. 2025-09-16 09:19:26 +03:00
ff9868db80 Add ssh deploykey 2025-09-16 09:18:24 +03:00
23e0e9e8b3 revert-ci 2025-06-17 11:29:54 +00:00
57b9fc55fb Обновить .gitea/workflows/java-pull-request-check-template.yml 2025-06-17 11:10:37 +00:00
beb42eccc3 Обновить .gitea/workflows/java-pull-request-check-template.yml 2025-06-17 10:37:56 +00:00
623ae7419a Обновить .gitea/workflows/java-pull-request-check-template.yml 2025-06-17 10:33:45 +00:00
7ea30bc13f Обновить .gitea/workflows/java-pull-request-check-template.yml 2025-06-17 10:24:20 +00:00
33b5813f9b Обновить .gitea/workflows/java-pull-request-check-template.yml 2025-06-17 10:10:58 +00:00
0413ac8e1e revert-ci 2025-01-15 13:42:57 +00:00
ac19e5c216 Обновить .gitea/workflows/werf-yonote-cleanup-template.yml 2025-01-15 13:36:39 +00:00
edd7dc9be9 Fix-ci-for-cleanup 2025-01-15 13:22:25 +00:00
49e4ec8307 add COMMIT_SHA in environment 2025-01-14 15:59:26 +00:00
9751c49015 Обновить .gitea/workflows/werf-yonote-cleanup-template.yml 2025-01-14 15:30:53 +00:00
86c9097497 Обновить .gitea/workflows/werf-yonote-cleanup-template.yml 2025-01-14 15:00:13 +00:00
5014550e10 Merge pull request 'Обновить .gitea/workflows/werf-yonote-cleanup-template.yml' (#11) from fix-cleanup-ci-yonote into master
Reviewed-on: #11
Reviewed-by: Stuart Armstrong <stuart.armstrong@wilix.team>
2025-01-14 13:30:15 +00:00
7f5aed727d Обновить .gitea/workflows/werf-yonote-cleanup-template.yml 2025-01-14 13:26:21 +00:00
69d88bed2e Merge pull request 'Cleanup-for-yonote' (#10) from Cleanup-for-yonote into master
Reviewed-on: #10
2024-06-06 05:27:32 +00:00
a2d4194b63 Rename 2024-06-06 08:25:58 +03:00
212671a6df Yonote cleanup template. 2024-06-06 08:24:13 +03:00
0267acbfe9 Merge pull request 'Change notify version to fix notifications.' (#9) from Change-mattermost-notify-version-to-fix-notifications into master
Reviewed-on: #9
2024-05-08 06:38:22 +00:00
10607492b5 Change notify version to fix notifications. 2024-05-07 15:06:21 +03:00
7b5c114675 Merge pull request 'actions add yonote check template.' (#8) from Actions-yonote-actions into master
Reviewed-on: #8
2024-01-23 12:59:12 +00:00
21dd806179 actions add yonote check template. 2024-01-23 15:53:24 +03:00
f1c7915415 Merge pull request 'LP-2725: disableable go cache' (#7) from LP-2725 into master
Reviewed-on: #7
2023-12-26 12:24:16 +00:00
3b47db723e LP-2725: disableable go cache 2023-12-26 15:23:40 +03:00
b1c60dc122 Merge pull request 'LP-2725: plugin ci template & actions' (#6) from LP-2725 into master
Reviewed-on: #6
2023-12-26 09:25:16 +00:00
9e81c6eeb3 Merge pull request 'Actions-add-node-template' (#5) from Actions-add-node-template into master
Reviewed-on: #5
Reviewed-by: Stanislav Melnichuk <s.melnichuk@wilix.org>
2023-12-22 10:30:38 +00:00
b42c130ed2 Remove required. 2023-12-22 13:25:15 +03:00
08596cf178 Add multi-project support. 2023-12-22 12:56:58 +03:00
a955139aa0 Remove double entry and gradle. 2023-12-22 11:52:02 +03:00
15175b5bb3 Actions add node tempate 2023-12-22 11:48:11 +03:00
7c51032221 Revert "Change ubuntu-latest to fix runner selection."
This reverts commit 0af153083c.
2023-12-21 15:30:27 +03:00
10 changed files with 594 additions and 9 deletions

View File

@@ -0,0 +1,45 @@
name: build-channel-export
description: Build plugin via make
inputs:
go_version:
required: false
description: 'GO version'
go_cache:
required: false
description: 'For direct disable go-cache if needed'
node_version:
required: false
description: 'Node.js version'
runs:
using: composite
steps:
- name: ci/setup-go
uses: actions/setup-go@v4
if: ${{ inputs.go_version && inputs.go_cache != 'false' }}
with:
go-version: "${{ inputs.go_version }}"
cache-dependency-path: |
go.sum
server/go.sum
- name: ci/setup-go-wo-cache
uses: actions/setup-go@v4
if: ${{ inputs.go_version && inputs.go_cache == 'false' }}
with:
go-version: "${{ inputs.go_version }}"
cache: false
- name: ci/setup-node
uses: actions/setup-node@v4
if: ${{ inputs.node_version }}
with:
node-version: "${{ inputs.node_version }}"
- name: ci/plugin-build
shell: bash
run: |
echo "::group::dist"
make dist
echo "::endgroup::"

View File

@@ -42,12 +42,12 @@ env:
jobs:
check:
name: check and test
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout@v3
- uses: https://github.com/actions/setup-java@v3
with:
distribution: 'temurin'
distribution: 'zulu'
java-version: 21
check-latest: "false"
- uses: https://github.com/gradle/gradle-build-action@v2
@@ -138,4 +138,4 @@ jobs:
- name: loop fail notification
if: ${{ inputs.notification_enabled && job.status == 'failure' }}
uses: https://github.com/mattermost/action-mattermost-notify@master
uses: https://github.com/mattermost/action-mattermost-notify@1.1.0

View File

@@ -0,0 +1,136 @@
name: Build and sign plugin with marketplace json formation
on:
workflow_call:
inputs:
go_version:
required: false
description: 'GO version'
go_cache:
required: false
description: 'For direct disable go-cache if needed'
node_version:
required: false
description: 'Node.js version'
vault_secrets_base_path:
required: true
description: 'Base vault secret path'
artifacts_url:
required: true
description: 'Artifacts URL'
artifacts_repository:
required: true
description: 'Artifacts repository'
secrets:
VAULT_ROLE_ID:
required: true
VAULT_SECRET_ID:
required: true
jobs:
release:
name: release
runs-on: ubuntu-22.04
steps:
- name: ci/checkout-repo
uses: actions/checkout@v3
- id: publish-secrets
name: ci/publish-secrets
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 }} ARTIFACTS_USERNAME ;
${{ inputs.vault_secrets_base_path }} ARTIFACTS_PASSWORD ;
- id: key
name: ci/key
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 }} SIGN_PRIVATE_KEY_EXPORTED ;
${{ inputs.vault_secrets_base_path }} SIGN_PRIVATE_KEY_ID ;
${{ inputs.vault_secrets_base_path }} SIGN_PRIVATE_KEY_PASSPHRASE ;
- id: plugin-meta
name: ci/plugin-meta
shell: bash
run: |
apt-get update
apt-get install -y jq
echo "PLUGIN=$(jq -r '.id + "-" + .version + ".tar.gz"' plugin.json)" >> "$GITHUB_OUTPUT"
echo "PLUGIN_ID=$(jq -r '.id' plugin.json)" >> "$GITHUB_OUTPUT"
echo "PLUGIN_VERSION=$(jq -r '.version' plugin.json)" >> "$GITHUB_OUTPUT"
echo "ENTERPRISE=$(jq -r '.props.enterprise == true' plugin.json)" >> "$GITHUB_OUTPUT"
echo "BETA=$(jq -r '.version | contains("SNAPSHOT")' plugin.json)" >> "$GITHUB_OUTPUT"
echo "EXPERIMENTAL=$(jq -r '.props.experimental == true' plugin.json)" >> "$GITHUB_OUTPUT"
- name: ci/plugin-build
uses: https://git.wilix.dev/wilix-infra/actions/.gitea/actions/plugin/build-channel-export@master
with:
go_version: ${{ inputs.go_version }}
go_cache: ${{ inputs.go_cache }}
node_version: ${{ inputs.node_version }}
ssh_key: ${{ secrets.AI_DEPLOY_KEY }}
- name: ci/plugin-sign
uses: https://git.wilix.dev/wilix-infra/actions/.gitea/actions/file-sign@master
with:
private_key: ${{ steps.key.outputs.SIGN_PRIVATE_KEY_EXPORTED }}
private_key_id: ${{ steps.key.outputs.SIGN_PRIVATE_KEY_ID }}
private_key_passphrase: ${{ steps.key.outputs.SIGN_PRIVATE_KEY_PASSPHRASE }}
filepath: ${{ gitea.workspace }}/dist/${{ steps.plugin-meta.outputs.PLUGIN }}
- name: ci/push-plugin
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: ${{ inputs.artifacts_url }}
username: ${{ steps.publish-secrets.outputs.ARTIFACTS_USERNAME }}
password: ${{ steps.publish-secrets.outputs.ARTIFACTS_PASSWORD }}
format: raw
repository: ${{ inputs.artifacts_repository }}
coordinates: directory=plugins/${{ steps.plugin-meta.outputs.PLUGIN_ID }}/${{ steps.plugin-meta.outputs.PLUGIN_VERSION }}
assets: filename=${{ steps.plugin-meta.outputs.PLUGIN }}
filename: dist/${{ steps.plugin-meta.outputs.PLUGIN }}
- name: ci/push-plugin-sign
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: ${{ inputs.artifacts_url }}
username: ${{ steps.publish-secrets.outputs.ARTIFACTS_USERNAME }}
password: ${{ steps.publish-secrets.outputs.ARTIFACTS_PASSWORD }}
format: raw
repository: ${{ inputs.artifacts_repository }}
coordinates: directory=plugins/${{ steps.plugin-meta.outputs.PLUGIN_ID }}/${{ steps.plugin-meta.outputs.PLUGIN_VERSION }}
assets: filename=${{ steps.plugin-meta.outputs.PLUGIN }}.sig
filename: dist/${{ steps.plugin-meta.outputs.PLUGIN }}.sig
- name: ci/plugin-json
uses: https://git.wilix.dev/wilix-infra/actions/.gitea/actions/plugin/json@master
with:
plugin_id: ${{ steps.plugin-meta.outputs.PLUGIN_ID }}
plugin_version: ${{ steps.plugin-meta.outputs.PLUGIN_VERSION }}
enterprise: ${{ steps.plugin-meta.outputs.ENTERPRISE }}
beta: ${{ steps.plugin-meta.outputs.BETA }}
experimental: ${{ steps.plugin-meta.outputs.EXPERIMENTAL }}
artifacts_url: ${{ inputs.artifacts_url }}
artifacts_repository: ${{ inputs.artifacts_repository }}
- name: ci/push-plugin-json
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: ${{ inputs.artifacts_url }}
username: ${{ steps.publish-secrets.outputs.ARTIFACTS_USERNAME }}
password: ${{ steps.publish-secrets.outputs.ARTIFACTS_PASSWORD }}
format: raw
repository: ${{ inputs.artifacts_repository }}
coordinates: directory=plugins/${{ steps.plugin-meta.outputs.PLUGIN_ID }}/${{ steps.plugin-meta.outputs.PLUGIN_VERSION }}
assets: filename=${{ steps.plugin-meta.outputs.PLUGIN }}.json
filename: dist/${{ steps.plugin-meta.outputs.PLUGIN }}.json

View File

@@ -57,7 +57,7 @@ jobs:
secrets: |
${{ inputs.vault_secrets_base_path }} SIGN_PRIVATE_KEY_EXPORTED ;
${{ inputs.vault_secrets_base_path }} SIGN_PRIVATE_KEY_ID ;
${{ inputs.vault_secrets_base_path }} SIGN_PRIVATE_KEY_PASSPHRASE ;
${{ inputs.vault_secrets_base_path }} SIGN_PRIVATE_KEY_PASSPHRASE ;
- id: plugin-meta
name: ci/plugin-meta
@@ -65,8 +65,8 @@ jobs:
run: |
apt-get update
apt-get install -y jq
echo "PLUGIN=$(jq -r '.id + "-" + .version + ".tar.gz"' plugin.json)" >> "$GITHUB_OUTPUT"
echo "PLUGIN_ID=$(jq -r '.id' plugin.json)" >> "$GITHUB_OUTPUT"
echo "PLUGIN=$(jq -r '.id + "-" + .version + ".tar.gz"' plugin.json)" >> "$GITHUB_OUTPUT"
echo "PLUGIN_ID=$(jq -r '.id' plugin.json)" >> "$GITHUB_OUTPUT"
echo "PLUGIN_VERSION=$(jq -r '.version' plugin.json)" >> "$GITHUB_OUTPUT"
echo "ENTERPRISE=$(jq -r '.props.enterprise == true' plugin.json)" >> "$GITHUB_OUTPUT"
echo "BETA=$(jq -r '.version | contains("SNAPSHOT")' plugin.json)" >> "$GITHUB_OUTPUT"
@@ -76,7 +76,9 @@ jobs:
uses: https://git.wilix.dev/wilix-infra/actions/.gitea/actions/plugin/build@master
with:
go_version: ${{ inputs.go_version }}
go_cache: ${{ inputs.go_cache }}
node_version: ${{ inputs.node_version }}
ssh_key: ${{ secrets.AI_DEPLOY_KEY }}
- name: ci/plugin-sign
uses: https://git.wilix.dev/wilix-infra/actions/.gitea/actions/file-sign@master

View File

@@ -0,0 +1,115 @@
name: Mobile pull request check
on:
workflow_call:
inputs:
node-version:
description: "Set node version"
default: 20
type: string
notification_enabled:
description: "Включение оповещений о разворачивании, требуется иметь url для оповещений в vault"
default: false
required: false
type: boolean
custom_notification_hook_enabled:
description: "Использовать ли кастомный url хук для оповещений (должен лежать в vault секрете проекта)"
default: false
required: false
type: boolean
notification_channel:
description: "Канал для оповещений о результатах деплоя"
default: internal_projects_notifications
required: false
type: string
vault_secrets_base_path:
description: 'Базовый путь для секретов проекта в vault'
required: false
type: string
secrets:
VAULT_ROLE_ID:
required: true
VAULT_SECRET_ID:
required: true
env:
vault_main_base_path: dev/wilix/main/data/ci
jobs:
check:
name: mobile check and test
runs-on: ubuntu-latest
steps:
- name: ci/checkout-repo
uses: actions/checkout@v3
- name: Use Node.js ${{ inputs.node-version }}
uses: https://github.com/actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- name: ci/prepare-node-deps
uses: ./.gitea/actions/prepare-node-deps
- name: ci/check-styles
shell: bash
run: |
echo "::group::check-styles"
npm run check
echo "::endgroup::"
- name: ci/run-tests
shell: bash
run: |
echo "::group::run-tests"
npm run test:ci
echo "::endgroup::"
- name: Get general notification url
if: ${{ inputs.notification_enabled && ! inputs.custom_notification_hook_enabled && (job.status == 'success' || job.status == 'failure') }}
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: |
${{ env.vault_main_base_path }} notification_url | MATTERMOST_WEBHOOK_URL ;
- name: Get custom notification url
if: ${{ inputs.notification_enabled && inputs.custom_notification_hook_enabled && (job.status == 'success' || job.status == 'failure') }}
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 failed notification body
if: ${{ inputs.notification_enabled && job.status == 'failure' }}
uses: https://github.com/finnp/create-file-action@master
env:
FILE_NAME: "mattermost.json"
FILE_DATA: |
{
"channel": "${{ inputs.notification_channel }}",
"attachments": [
{
"fallback": "Проверка упала ${{ gitea.repository }}",
"text": "@${{ gitea.actor }} упала тестовая сборка",
"color": "#FF0000",
"fields": [
{
"short": true,
"title": "Сборка",
"value": "https://git.wilix.dev/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}"
}
]
}
]
}
- name: loop fail notification
if: ${{ inputs.notification_enabled && job.status == 'failure' }}
uses: https://github.com/mattermost/action-mattermost-notify@1.1.0

View File

@@ -0,0 +1,112 @@
name: Pull request check
on:
workflow_call:
inputs:
node-version:
description: "Set node version"
default: 20
type: string
yarn-commands:
description: "yarn-commands"
default: |-
yarn install
yarn test
type: string
notification_enabled:
description: "Включение оповещений о разворачивании, требуется иметь url для оповещений в vault"
default: false
required: false
type: boolean
custom_notification_hook_enabled:
description: "Использовать ли кастомный url хук для оповещений (должен лежать в vault секрете проекта)"
default: false
required: false
type: boolean
notification_channel:
description: "Канал для оповещений о результатах деплоя"
default: internal_projects_notifications
required: false
type: string
vault_secrets_base_path:
description: 'Базовый путь для секретов проекта в vault'
required: false
type: string
sonar_enabled:
default: false
required: false
type: boolean
secrets:
VAULT_ROLE_ID:
required: true
VAULT_SECRET_ID:
required: true
env:
vault_main_base_path: dev/wilix/main/data/ci
jobs:
check:
name: check and test
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout@v3
- name: Use Node.js ${{ inputs.node-version }}
uses: https://github.com/actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- run: ${{ inputs.yarn-commands }}
- name: dockerfile lint check
uses: https://github.com/hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
- name: Get general notification url
if: ${{ inputs.notification_enabled && ! inputs.custom_notification_hook_enabled && (job.status == 'success' || job.status == 'failure') }}
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: |
${{ env.vault_main_base_path }} notification_url | MATTERMOST_WEBHOOK_URL ;
- name: Get custom notification url
if: ${{ inputs.notification_enabled && inputs.custom_notification_hook_enabled && (job.status == 'success' || job.status == 'failure') }}
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 failed notification body
if: ${{ inputs.notification_enabled && job.status == 'failure' }}
uses: https://github.com/finnp/create-file-action@master
env:
FILE_NAME: "mattermost.json"
FILE_DATA: |
{
"channel": "${{ inputs.notification_channel }}",
"attachments": [
{
"fallback": "Проверка упала ${{ gitea.repository }}",
"text": "@${{ gitea.actor }} упала тестовая сборка",
"color": "#FF0000",
"fields": [
{
"short": true,
"title": "Сборка",
"value": "https://git.wilix.dev/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}"
}
]
}
]
}
- name: loop fail notification
if: ${{ inputs.notification_enabled && job.status == 'failure' }}
uses: https://github.com/mattermost/action-mattermost-notify@1.1.0

View File

@@ -26,7 +26,7 @@ env:
jobs:
cleanup:
name: Cleanup
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout@v3
- name: Fetch all history for all tags and branches

View File

@@ -62,7 +62,7 @@ env:
jobs:
converge:
name: Deploy stand
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
@@ -197,5 +197,5 @@ jobs:
}
- name: loop fail notification
uses: https://github.com/mattermost/action-mattermost-notify@master
uses: https://github.com/mattermost/action-mattermost-notify@1.1.0
if: ${{ inputs.notification_enabled && (job.status == 'success' || job.status == 'failure') }}

View File

@@ -0,0 +1,68 @@
name: Cleanup Yonote Docker registry
on:
workflow_call:
inputs:
docker_repo_path:
default: private.docker.wilix.dev
required: false
type: string
docker_images_path:
description: 'Относительный путь для образов проекта'
required: true
type: string
werf_debug:
default: false
required: false
type: boolean
secrets:
VAULT_ROLE_ID:
required: true
VAULT_SECRET_ID:
required: true
env:
vault_main_base_path: dev/wilix/main/data/ci
jobs:
cleanup:
name: Cleanup
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout@v3
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
# FIXME Эти секреты нужно будет сделать полностью различными для проектов, идеально - краткосрочные генерируемые vault
- id: import-secrets
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: |
${{ env.vault_main_base_path }} local_cluster_kube_config_base64 ;
${{ env.vault_main_base_path }} docker_registry_username ;
${{ env.vault_main_base_path }} docker_registry_password ;
dev/wilix/yonote/data/ci/yonote NPM_AUTH_TOKEN ;
- name: Login to wilix nexus Container Registry
uses: https://github.com/docker/login-action@v2
with:
registry: ${{ inputs.docker_repo_path }}
username: ${{ steps.import-secrets.outputs.docker_registry_username }}
password: ${{ steps.import-secrets.outputs.docker_registry_password }}
- name: Install werf
uses: https://github.com/werf/actions/install@v1.2
- name: Setup debug if need
if: ${{ inputs.werf_debug }}
run: echo "WERF_LOG_DEBUG=true" >> "$GITHUB_ENV"
- name: Cleanup
run: werf cleanup
env:
WERF_REPO: ${{ inputs.docker_repo_path }}/${{ inputs.docker_images_path }}
WERF_KUBECONFIG_BASE64: ${{ steps.import-secrets.outputs.local_cluster_kube_config_base64 }}
NPM_AUTH_TOKEN: ${{ steps.import-secrets.outputs.NPM_AUTH_TOKEN }}

View File

@@ -0,0 +1,107 @@
name: Pull request check
on:
workflow_call:
inputs:
node-version:
description: "Set node version"
default: 20
type: string
yarn-commands:
description: "yarn-commands"
default: |-
yarn install
yarn test
type: string
notification_enabled:
description: "Включение оповещений о разворачивании, требуется иметь url для оповещений в vault"
default: false
required: false
type: boolean
custom_notification_hook_enabled:
description: "Использовать ли кастомный url хук для оповещений (должен лежать в vault секрете проекта)"
default: false
required: false
type: boolean
notification_channel:
description: "Канал для оповещений о результатах деплоя"
default: internal_projects_notifications
required: false
type: string
vault_secrets_base_path:
description: 'Базовый путь для секретов проекта в vault'
required: false
type: string
sonar_enabled:
default: false
required: false
type: boolean
secrets:
VAULT_ROLE_ID:
required: true
VAULT_SECRET_ID:
required: true
env:
vault_main_base_path: dev/wilix/main/data/ci
jobs:
check:
name: check and test
runs-on: ubuntu-latest
steps:
- uses: https://github.com/actions/checkout@v3
- name: Use Node.js ${{ inputs.node-version }}
uses: https://github.com/actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- run: ${{ inputs.yarn-commands }}
- name: Get general notification url
if: ${{ inputs.notification_enabled && ! inputs.custom_notification_hook_enabled && (job.status == 'success' || job.status == 'failure') }}
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: |
${{ env.vault_main_base_path }} notification_url | MATTERMOST_WEBHOOK_URL ;
- name: Get custom notification url
if: ${{ inputs.notification_enabled && inputs.custom_notification_hook_enabled && (job.status == 'success' || job.status == 'failure') }}
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 failed notification body
if: ${{ inputs.notification_enabled && job.status == 'failure' }}
uses: https://github.com/finnp/create-file-action@master
env:
FILE_NAME: "mattermost.json"
FILE_DATA: |
{
"channel": "${{ inputs.notification_channel }}",
"attachments": [
{
"fallback": "Проверка упала ${{ gitea.repository }}",
"text": "@${{ gitea.actor }} упала тестовая сборка",
"color": "#FF0000",
"fields": [
{
"short": true,
"title": "Сборка",
"value": "https://git.wilix.dev/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}"
}
]
}
]
}
- name: loop fail notification
if: ${{ inputs.notification_enabled && job.status == 'failure' }}
uses: https://github.com/mattermost/action-mattermost-notify@1.1.0