diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2022-12-02 10:17:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-02 10:17:41 -0500 |
commit | cf199ac0344a6e77ca76879f70d883ddaf1ca6ff (patch) | |
tree | df0be507a3261f601daa9a6047133d9b54c82046 /.github/workflows | |
parent | 3fc34a5e32fc16c7c832a0caefddf913c4e56eac (diff) |
Update workflows to use $GITHUB_OUTPUT instead of ::set-output:: (#13960)
* Update workflows to use $GITHUB_OUTPUT instead of ::set-output::
* Fix python code.
* Fix handling of python-based build matrix generation.
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build.yml | 45 | ||||
-rw-r--r-- | .github/workflows/cloud_regression.yml | 8 | ||||
-rw-r--r-- | .github/workflows/codeql.yml | 18 | ||||
-rw-r--r-- | .github/workflows/docker.yml | 4 | ||||
-rw-r--r-- | .github/workflows/packaging.yml | 64 | ||||
-rw-r--r-- | .github/workflows/repoconfig-packages.yml | 27 | ||||
-rw-r--r-- | .github/workflows/review.yml | 30 |
7 files changed, 60 insertions, 136 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53f1590f8a..2e4c657c6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,7 @@ jobs: --with-math \ --with-user=netdata make dist - echo "::set-output name=distfile::$(find . -name 'netdata-*.tar.gz')" + echo "distfile=$(find . -name 'netdata-*.tar.gz')" >> "${GITHUB_OUTPUT}" cp netdata-*.tar.gz artifacts/ - name: Store id: store @@ -183,39 +183,10 @@ jobs: sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml - name: Read build matrix id: set-matrix - shell: python3 {0} run: | - from ruamel.yaml import YAML - import json - yaml = YAML(typ='safe') - entries = list() - - with open('.github/data/distros.yml') as f: - data = yaml.load(f) - - for i, v in enumerate(data['include']): - e = { - 'artifact_key': v['distro'] + str(v['version']).replace('.', ''), - 'version': v['version'], - } - - if 'base_image' in v: - e['distro'] = ':'.join([v['base_image'], str(v['version'])]) - else: - e['distro'] = ':'.join([v['distro'], str(v['version'])]) - - if 'env_prep' in v: - e['env_prep'] = v['env_prep'] - - if 'jsonc_removal' in v: - e['jsonc_removal'] = v['jsonc_removal'] - - entries.append(e) - - entries.sort(key=lambda k: k['distro']) - matrix = json.dumps({'include': entries}, sort_keys=True) - print('Generated Matrix: ' + matrix) - print('::set-output name=matrix::' + matrix) + matrix="$(.github/scripts/gen-matrix-build.py)" + echo "Generated matrix: ${matrix}" + echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: @@ -363,7 +334,7 @@ jobs: id: load run: | docker load --input image.tar | tee image-info.txt - echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)" + echo "image=$(cut -d ':' -f 3 image-info.txt)" >> "${GITHUB_OUTPUT}" - name: Regular build on ${{ matrix.distro }} id: build-basic run: | @@ -458,7 +429,7 @@ jobs: id: load run: | docker load --input image.tar | tee image-info.txt - echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)" + echo "image=$(cut -d ':' -f 3 image-info.txt)" >> "${GITHUB_OUTPUT}" - name: Install netdata and run the updater on ${{ matrix.distro }} id: updater-check run: | @@ -790,9 +761,9 @@ jobs: id: tag run: | if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then - echo "::set-output name=tag::v${{ github.event.inputs.version }}" + echo "tag=v${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}" else - echo "::set-output name=tag::${{ github.event.inputs.version }}" + echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}" fi upload-release: # Create the draft release and upload the build artifacts. diff --git a/.github/workflows/cloud_regression.yml b/.github/workflows/cloud_regression.yml index 9ebe66687f..01fcdca4db 100644 --- a/.github/workflows/cloud_regression.yml +++ b/.github/workflows/cloud_regression.yml @@ -33,10 +33,10 @@ jobs: NETDATA_CUSTOM_PR_NUMBER="" NETDATA_CUSTOM_COMMIT_HASH="${{ github.sha }}" fi - echo "netdata_repo=${NETDATA_CUSTOM_REPO}" >> $GITHUB_OUTPUT - echo "netdata_branch=${NETDATA_CUSTOM_BRANCH}" >> $GITHUB_OUTPUT - echo "netdata_pr_number=${NETDATA_CUSTOM_PR_NUMBER}" >> $GITHUB_OUTPUT - echo "netdata_commit_hash=${NETDATA_CUSTOM_COMMIT_HASH}" >> $GITHUB_OUTPUT + echo "netdata_repo=${NETDATA_CUSTOM_REPO}" >> $GITHUB_OUTPUT + echo "netdata_branch=${NETDATA_CUSTOM_BRANCH}" >> $GITHUB_OUTPUT + echo "netdata_pr_number=${NETDATA_CUSTOM_PR_NUMBER}" >> $GITHUB_OUTPUT + echo "netdata_commit_hash=${NETDATA_CUSTOM_COMMIT_HASH}" >> $GITHUB_OUTPUT - name: Trigger Full Cloud Regression uses: aurelien-baudet/workflow-dispatch@v2 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 021376a2d5..4f62f9fc57 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -32,39 +32,39 @@ jobs: run: | if [ "${{ github.event_name }}" = "pull_request" ]; then if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/codeql') }}" = "true" ]; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo '::notice::Found ci/codeql label, unconditionally running all CodeQL checks.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi else - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" fi - name: Check for C/C++ changes id: cpp run: | if [ "${{ steps.always.outputs.run }}" = "false" ]; then if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.[ch](xx|\+\+)?' ; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo '::notice::C/C++ code has changed, need to run CodeQL.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi else - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" fi - name: Check for python changes id: python run: | if [ "${{ steps.always.outputs.run }}" = "false" ]; then if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq 'collectors/python.d.plugin/.*\.py' ; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo '::notice::Python code has changed, need to run CodeQL.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi else - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" fi analyze-cpp: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b7eb53c8ec..ff40697acf 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -129,9 +129,9 @@ jobs: id: tag run: | if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then - echo "::set-output name=tag::v${{ github.event.inputs.version }}" + echo "tag=v${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}" else - echo "::set-output name=tag::${{ github.event.inputs.version }}" + echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}" fi docker-publish: diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index ddd8356e43..72042ab917 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -44,41 +44,15 @@ jobs: sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml - name: Read build matrix id: set-matrix - shell: python3 {0} run: | - from ruamel.yaml import YAML - import json - import re - import os - ALWAYS_RUN_ARCHES = ["amd64", "x86_64"] - yaml = YAML(typ='safe') - entries = list() - run_limited = False - - with open('.github/data/distros.yml') as f: - data = yaml.load(f) - - if "${{ github.event_name }}" == "pull_request" and "${{ !contains(github.event.pull_request.labels.*.name, 'run-ci/packaging') }}": - run_limited = True - - for i, v in enumerate(data['include']): - if 'packages' in data['include'][i]: - for arch in data['include'][i]['packages']['arches']: - if arch in ALWAYS_RUN_ARCHES or not run_limited: - entries.append({ - 'distro': data['include'][i]['distro'], - 'version': data['include'][i]['version'], - 'repo_distro': data['include'][i]['packages']['repo_distro'], - 'format': data['include'][i]['packages']['type'], - 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'], - 'platform': data['platform_map'][arch], - 'arch': arch - }) - - entries.sort(key=lambda k: (data['arch_order'].index(k['arch']), k['distro'], k['version'])) - matrix = json.dumps({'include': entries}, sort_keys=True) - print('Generated Matrix: ' + matrix) - print('::set-output name=matrix::' + matrix) + if [ "${{ github.event_name }}" = "pull_request" ] && \ + [ "${{ !contains(github.event.pull_request.labels.*.name, 'run-ci/packaging') }}" = "true" ]; then + matrix="$(.github/scripts/gen-matrix-packaging.py 1)" + else + matrix="$(.github/scripts/gen-matrix-packaging.py 0)" + fi + echo "Generated matrix: ${matrix}" + echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: @@ -117,24 +91,24 @@ jobs: if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then case "${{ github.event.inputs.type }}" in "release") - echo "::set-output name=repo::${REPO_PREFIX}" - echo "::set-output name=version::${{ github.event.inputs.version }}" - echo "::set-output name=retention::365" + echo "repo=${REPO_PREFIX}" >> "${GITHUB_OUTPUT}" + echo "version=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}" + echo "retention=365" >> "${GITHUB_OUTPUT}" ;; "nightly") - echo "::set-output name=repo::${REPO_PREFIX}-edge" - echo "::set-output name=version::$(tr -d 'v' < packaging/version)" - echo "::set-output name=retention::30" + echo "repo=${REPO_PREFIX}-edge" >> "${GITHUB_OUTPUT}" + echo "version=$(tr -d 'v' < packaging/version)" >> "${GITHUB_OUTPUT}" + echo "retention=30" >> "${GITHUB_OUTPUT}" ;; *) - echo "::set-output name=repo::${REPO_PREFIX}-devel" - echo "::set-output name=version::0.${GITHUB_SHA}" - echo "::set-output name=retention::30" + echo "repo=${REPO_PREFIX}-devel" >> "${GITHUB_OUTPUT}" + echo "version=0.${GITHUB_SHA}" >> "${GITHUB_OUTPUT}" + echo "retention=30" >> "${GITHUB_OUTPUT}" ;; esac else - echo "::set-output name=version::$(cut -d'-' -f 1 packaging/version | tr -d 'v')" - echo "::set-output name=retention::0" + echo "version=$(cut -d'-' -f 1 packaging/version | tr -d 'v')" >> "${GITHUB_OUTPUT}" + echo "retention=0" >> "${GITHUB_OUTPUT}" fi - name: Failure Notification uses: rtCamp/action-slack-notify@v2 diff --git a/.github/workflows/repoconfig-packages.yml b/.github/workflows/repoconfig-packages.yml index 824ddd3412..0021f62bd8 100644 --- a/.github/workflows/repoconfig-packages.yml +++ b/.github/workflows/repoconfig-packages.yml @@ -34,31 +34,10 @@ jobs: sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml - name: Read build matrix id: set-matrix - shell: python3 {0} run: | - from ruamel.yaml import YAML - import json - yaml = YAML(typ='safe') - entries = list() - - with open('.github/data/distros.yml') as f: - data = yaml.load(f) - - for i, v in enumerate(data['include']): - if 'packages' in data['include'][i]: - entries.append({ - 'distro': data['include'][i]['distro'], - 'version': data['include'][i]['version'], - 'pkgclouddistro': data['include'][i]['packages']['repo_distro'], - 'format': data['include'][i]['packages']['type'], - 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'], - 'platform': data['platform_map']['amd64'] - }) - - entries.sort(key=lambda k: (k['distro'], k['version'])) - matrix = json.dumps({'include': entries}, sort_keys=True) - print('Generated Matrix: ' + matrix) - print('::set-output name=matrix::' + matrix) + matrix="$(.github/scripts/gen-matrix-repoconfig.py)" + echo "Generated matrix: ${matrix}" + echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 5679b246c1..7f12aeecdc 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -29,56 +29,56 @@ jobs: id: actionlint run: | if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/actionlint') }}" = "true" ]; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '\.github/workflows/.*' ; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo 'GitHub Actions workflows have changed, need to run actionlint.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi - name: Check files for eslint id: eslint run: | if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/eslint') }}" = "true" ]; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -v "web/gui/dashboard" | grep -Eq '.*\.js|node\.d\.plugin\.in' ; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo 'JS files have changed, need to run ESLint.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi - name: Check files for hadolint id: hadolint run: | if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/hadolint') }}" = "true" ]; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*Dockerfile.*' ; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo 'Dockerfiles have changed, need to run Hadolint.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi - name: Check files for shellcheck id: shellcheck run: | if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/shellcheck') }}" = "true" ]; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.sh.*' ; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo 'Shell scripts have changed, need to run shellcheck.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi - name: Check files for yamllint id: yamllint run: | if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/yamllint') }}" = "true" ]; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.ya?ml|python\.d/.*\.conf' ; then - echo '::set-output name=run::true' + echo "run=true" >> "${GITHUB_OUTPUT}" echo 'YAML files have changed, need to run yamllint.' else - echo '::set-output name=run::false' + echo "run=false" >> "${GITHUB_OUTPUT}" fi actionlint: |