[internal] removed some legacy code and release notes fix (#124) #809
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push for dev | |
env: | |
MODULES_REGISTRY: ${{ vars.DEV_REGISTRY }} | |
CI_COMMIT_REF_NAME: ${{ github.ref_name }} | |
MODULES_MODULE_NAME: ${{ vars.MODULE_NAME }} | |
MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }} | |
MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} | |
MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} | |
GOPROXY: ${{ secrets.GOPROXY }} | |
SOURCE_REPO: ${{ secrets.SOURCE_REPO }} | |
SOURCE_REPO_SSH_KEY: ${{ secrets.SOURCE_REPO_SSH_KEY }} | |
BASE_IMAGES_VERSION: "v0.5.25" | |
on: | |
#pull_request: | |
# call from trivy_image_check.yaml, which in turn call from pull_request | |
# https://stackoverflow.com/a/71489231 | |
workflow_call: | |
inputs: | |
svace_enabled: | |
description: "Enable svace build and analyze" | |
type: boolean | |
required: false | |
push: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: [self-hosted, regular] | |
continue-on-error: true | |
name: Lint | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Copy openapi/values_ce.yaml to openapi/values.yaml | |
run: | | |
if [ -f openapi/values_ce.yaml ]; then | |
cp -f openapi/values_ce.yaml openapi/values.yaml | |
fi | |
- uses: deckhouse/modules-actions/lint@main | |
env: | |
DMT_METRICS_URL: ${{ secrets.DMT_METRICS_URL }} | |
DMT_METRICS_TOKEN: ${{ secrets.DMT_METRICS_TOKEN }} | |
- name: Copy openapi/values_ee.yaml to openapi/values.yaml | |
run: | | |
if [ -f openapi/values_ee.yaml ]; then | |
cp -f openapi/values_ee.yaml openapi/values.yaml | |
fi | |
- uses: deckhouse/modules-actions/lint@main | |
env: | |
DMT_METRICS_URL: ${{ secrets.DMT_METRICS_URL }} | |
DMT_METRICS_TOKEN: ${{ secrets.DMT_METRICS_TOKEN }} | |
set_edition: | |
runs-on: [self-hosted, large] | |
name: Set edition | |
outputs: | |
module_edition: ${{ steps.set-vars.outputs.MODULE_EDITION }} | |
steps: | |
- name: Get Pull Request Labels | |
id: get-labels | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
if (context.eventName === "pull_request" || context.eventName === "pull_request_target" ) { | |
const prNumber = context.payload.pull_request.number; | |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
}); | |
return labels.map(label => label.name); | |
} else { | |
return []; | |
} | |
result-encoding: string | |
- name: Set vars | |
id: set-vars | |
run: | | |
# Select edition for build, default ee | |
if echo "${{ steps.get-labels.outputs.result }}" | grep -q "edition/ce"; then | |
echo "MODULE_EDITION=ce" >> "$GITHUB_OUTPUT" | |
else | |
echo "MODULE_EDITION=ee" >> "$GITHUB_OUTPUT" | |
fi | |
dev_setup_build: | |
runs-on: [self-hosted, large] | |
name: Build and Push images | |
needs: [set_edition] | |
env: | |
MODULE_EDITION: ${{needs.set_edition.outputs.module_edition}} | |
steps: | |
- name: Set vars for PR | |
if: ${{ github.ref_name != 'main' }} | |
run: | | |
MODULES_MODULE_TAG="$(echo pr${{ github.ref_name }} | sed 's/\/.*//g')" | |
echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_ENV" | |
- name: Set vars for main | |
if: ${{ github.ref_name == 'main' }} | |
run: | | |
echo "MODULES_MODULE_TAG=${{ github.ref_name }}" >> "$GITHUB_ENV" | |
- name: Print vars | |
run: | | |
echo MODULES_REGISTRY=$MODULES_REGISTRY | |
echo CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME | |
echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME | |
echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE | |
echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG | |
echo MODULE_EDITION=$MODULE_EDITION | |
- uses: actions/checkout@v4 | |
- name: Download base images and auth prepare | |
run: | | |
wget https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/$BASE_IMAGES_VERSION/base_images.yml -O base_images.yml | |
cat base_images.yml | |
- uses: deckhouse/modules-actions/setup@v4 | |
with: | |
registry: ${{ vars.DEV_REGISTRY }} | |
registry_login: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} | |
registry_password: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} | |
- uses: deckhouse/modules-actions/build@v4 | |
with: | |
module_source: "${{ vars.DEV_MODULE_SOURCE }}" | |
module_name: ${{ vars.MODULE_NAME }} | |
module_tag: ${{ env.MODULES_MODULE_TAG }} | |
source_repo: ${{ secrets.SOURCE_REPO }} | |
source_repo_ssh_key: ${{ secrets.SOURCE_REPO_SSH_KEY }} | |
svace_enabled: ${{ contains(github.event.pull_request.labels.*.name, 'analyze/svace') || github.event.inputs.svace_enabled }} | |
svace_analyze_host: "${{ secrets.SVACE_ANALYZE_HOST }}" | |
svace_analyze_ssh_user: "${{ secrets.SVACE_ANALYZE_SSH_USER }}" | |
svace_analyze_ssh_key: "${{ secrets.SVACE_ANALYZE_SSH_PRIVATE_KEY }}" | |
analyze_build: | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'analyze/svace') || github.event.inputs.svace_enabled == 'true' }} | |
name: Analyze build | |
runs-on: [self-hosted, large] | |
needs: | |
- dev_setup_build | |
steps: | |
- uses: deckhouse/modules-actions/svace_analyze@v4 | |
with: | |
project_group: ${{ github.event.repository.name }} | |
ci_commit_ref_name: ${{ github.event.pull_request.head.ref || github.ref_name }} | |
ci_commit_hash: ${{ github.sha }} | |
svace_analyze_host: "${{ secrets.SVACE_ANALYZE_HOST }}" | |
svace_analyze_ssh_user: "${{ secrets.SVACE_ANALYZE_SSH_USER }}" | |
svacer_url: "${{ secrets.SVACER_URL }}" | |
svacer_import_user: "${{ secrets.SVACER_IMPORT_USER }}" | |
svacer_import_password: "${{ secrets.SVACER_IMPORT_PASSWORD }}" | |
svace_analyze_ssh_private_key: "${{ secrets.SVACE_ANALYZE_SSH_PRIVATE_KEY }}" |