mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 17:50:20 +00:00
147 lines
5.1 KiB
Django/Jinja
147 lines
5.1 KiB
Django/Jinja
<%- set gh_environment = gh_environment|default("nightly") %>
|
|
<%- set skip_test_coverage_check = skip_test_coverage_check|default("false") %>
|
|
<%- set skip_junit_reports_check = skip_junit_reports_check|default("false") %>
|
|
<%- set prepare_workflow_skip_test_suite = "${{ inputs.skip-salt-test-suite && ' --skip-tests' || '' }}" %>
|
|
<%- set prepare_workflow_skip_pkg_test_suite = "${{ inputs.skip-salt-pkg-test-suite && ' --skip-pkg-tests' || '' }}" %>
|
|
<%- set prepare_workflow_if_check = prepare_workflow_if_check|default("${{ fromJSON(needs.workflow-requirements.outputs.requirements-met) }}") %>
|
|
<%- extends 'ci.yml.jinja' %>
|
|
|
|
<%- block name %>
|
|
|
|
name: <{ workflow_name }>
|
|
run-name: "<{ workflow_name }> (branch: ${{ github.ref_name }})"
|
|
|
|
<%- endblock name %>
|
|
|
|
<%- block on %>
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
skip-salt-test-suite:
|
|
type: boolean
|
|
default: false
|
|
description: Skip running the Salt test suite.
|
|
skip-salt-pkg-test-suite:
|
|
type: boolean
|
|
default: false
|
|
description: Skip running the Salt packages test suite.
|
|
schedule:
|
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onschedule
|
|
- cron: '0 1 * * *' # Every day at 1AM
|
|
|
|
<%- endblock on %>
|
|
|
|
<%- block concurrency %>
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.repository }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: false
|
|
|
|
<%- endblock concurrency %>
|
|
|
|
<%- block permissions %>
|
|
<{- super() }>
|
|
<%- if workflow_slug == "nightly" %>
|
|
actions: write # to trigger branch nightly builds
|
|
<%- endif %>
|
|
<%- endblock permissions %>
|
|
|
|
<%- block pre_jobs %>
|
|
|
|
<%- include "workflow-requirements-check.yml.jinja" %>
|
|
<%- include "trigger-branch-workflows.yml.jinja" %>
|
|
|
|
<%- endblock pre_jobs %>
|
|
|
|
<%- block jobs %>
|
|
<{- super() }>
|
|
|
|
<%- if includes.get("build-repos", True) %>
|
|
<%- include "build-repos.yml.jinja" %>
|
|
<%- endif %>
|
|
|
|
publish-repositories:
|
|
<%- do conclusion_needs.append('publish-repositories') %>
|
|
name: Publish Repositories
|
|
if: ${{ always() && ! failure() && ! cancelled() }}
|
|
runs-on:
|
|
- self-hosted
|
|
- linux
|
|
- repo-<{ gh_environment }>
|
|
environment: <{ gh_environment }>
|
|
needs:
|
|
- prepare-workflow
|
|
<%- for need in build_repo_needs.iter(consume=True) %>
|
|
- <{ need }>
|
|
<%- endfor %>
|
|
<%- if workflow_slug == "nightly" %>
|
|
<%- for need in test_salt_needs.iter(consume=True) %>
|
|
- <{ need }>
|
|
<%- endfor %>
|
|
<%- endif %>
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Get Salt Project GitHub Actions Bot Environment
|
|
run: |
|
|
TOKEN=$(curl -sS -f -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 30")
|
|
SPB_ENVIRONMENT=$(curl -sS -f -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/tags/instance/spb:environment)
|
|
echo "SPB_ENVIRONMENT=$SPB_ENVIRONMENT" >> "$GITHUB_ENV"
|
|
|
|
- name: Setup Python Tools Scripts
|
|
uses: ./.github/actions/setup-python-tools-scripts
|
|
|
|
- name: Download Repository Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: salt-${{ needs.prepare-workflow.outputs.salt-version }}-<{ gh_environment }>-repo
|
|
path: repo/
|
|
|
|
- name: Decompress Repository Artifacts
|
|
run: |
|
|
find repo/ -type f -name '*.tar.gz' -print -exec tar xvf {} \;
|
|
find repo/ -type f -name '*.tar.gz' -print -exec rm -f {} \;
|
|
|
|
- name: Show Repository
|
|
run: |
|
|
tree -a artifacts/pkgs/repo/
|
|
|
|
- name: Upload Repository Contents (<{ gh_environment }>)
|
|
env:
|
|
SALT_REPO_DOMAIN_RELEASE: ${{ vars.SALT_REPO_DOMAIN_RELEASE || 'repo.saltproject.io' }}
|
|
SALT_REPO_DOMAIN_STAGING: ${{ vars.SALT_REPO_DOMAIN_STAGING || 'staging.repo.saltproject.io' }}
|
|
run: |
|
|
tools pkg repo publish <{ gh_environment }> --salt-version=${{ needs.prepare-workflow.outputs.salt-version }} artifacts/pkgs/repo/
|
|
|
|
<%- endblock jobs %>
|
|
|
|
<%- block set_pipeline_exit_status_extra_steps %>
|
|
|
|
<%- if workflow_slug == "nightly" %>
|
|
|
|
- name: Notify Slack
|
|
id: slack
|
|
uses: slackapi/slack-github-action@v1.24.0
|
|
with:
|
|
payload: |
|
|
{
|
|
"text": "Nightly Workflow build result for the ${{ github.ref_name }} branch: ${{ steps.get-workflow-info.outputs.conclusion }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "Nightly Workflow build result for the ${{ github.ref_name }} branch: ${{ steps.get-workflow-info.outputs.conclusion }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
|
|
|
|
<%- endif %>
|
|
|
|
<%- endblock set_pipeline_exit_status_extra_steps %>
|