mirror of
https://github.com/netdata/netdata.git
synced 2025-05-05 09:40:18 +00:00
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.
This commit is contained in:
parent
3fc34a5e32
commit
cf199ac034
12 changed files with 188 additions and 164 deletions
34
.github/scripts/gen-matrix-build.py
vendored
Executable file
34
.github/scripts/gen-matrix-build.py
vendored
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
yaml = YAML(typ='safe')
|
||||||
|
entries = []
|
||||||
|
|
||||||
|
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(matrix)
|
36
.github/scripts/gen-matrix-packaging.py
vendored
Executable file
36
.github/scripts/gen-matrix-packaging.py
vendored
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
ALWAYS_RUN_ARCHES = ["amd64", "x86_64"]
|
||||||
|
SHORT_RUN = sys.argv[1]
|
||||||
|
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 bool(int(SHORT_RUN)):
|
||||||
|
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(matrix)
|
26
.github/scripts/gen-matrix-repoconfig.py
vendored
Executable file
26
.github/scripts/gen-matrix-repoconfig.py
vendored
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
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(matrix)
|
2
.github/scripts/get-static-cache-key.sh
vendored
2
.github/scripts/get-static-cache-key.sh
vendored
|
@ -12,4 +12,4 @@ docker run -it --rm --platform "${platform}" netdata/static-builder sh -c 'apk l
|
||||||
|
|
||||||
h="$(sha256sum /tmp/static-cache-key-data | cut -f 1 -d ' ')"
|
h="$(sha256sum /tmp/static-cache-key-data | cut -f 1 -d ' ')"
|
||||||
|
|
||||||
echo "::set-output name=key::static-${arch}-${h}"
|
echo "key=static-${arch}-${h}" >> "${GITHUB_OUTPUT}"
|
||||||
|
|
58
.github/scripts/prepare-release-base.sh
vendored
58
.github/scripts/prepare-release-base.sh
vendored
|
@ -97,7 +97,7 @@ git config user.email "bot@netdata.cloud"
|
||||||
|
|
||||||
if [ "${REPO}" != "netdata/netdata" ] && [ -z "${RELEASE_TEST}" ]; then
|
if [ "${REPO}" != "netdata/netdata" ] && [ -z "${RELEASE_TEST}" ]; then
|
||||||
echo "::notice::Not running in the netdata/netdata repository, not queueing a release build."
|
echo "::notice::Not running in the netdata/netdata repository, not queueing a release build."
|
||||||
echo "::set-output name=run::false"
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
elif [ "${EVENT_NAME}" = 'schedule' ] || [ "${EVENT_TYPE}" = 'nightly' ]; then
|
elif [ "${EVENT_NAME}" = 'schedule' ] || [ "${EVENT_TYPE}" = 'nightly' ]; then
|
||||||
echo "::notice::Preparing a nightly release build."
|
echo "::notice::Preparing a nightly release build."
|
||||||
LAST_TAG=$(git describe --abbrev=0 --tags)
|
LAST_TAG=$(git describe --abbrev=0 --tags)
|
||||||
|
@ -107,15 +107,16 @@ elif [ "${EVENT_NAME}" = 'schedule' ] || [ "${EVENT_TYPE}" = 'nightly' ]; then
|
||||||
HEAD_COMMIT="$(git rev-parse HEAD)"
|
HEAD_COMMIT="$(git rev-parse HEAD)"
|
||||||
if [ "${EVENT_NAME}" = 'schedule' ] && [ "${LAST_VERSION_COMMIT}" = "${HEAD_COMMIT}" ] && grep -qE '.*-nightly$' packaging/version; then
|
if [ "${EVENT_NAME}" = 'schedule' ] && [ "${LAST_VERSION_COMMIT}" = "${HEAD_COMMIT}" ] && grep -qE '.*-nightly$' packaging/version; then
|
||||||
echo "::notice::No commits since last nightly build, not publishing a new nightly build."
|
echo "::notice::No commits since last nightly build, not publishing a new nightly build."
|
||||||
echo "::set-output name=run::false"
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
else
|
else
|
||||||
echo "${NEW_VERSION}" > packaging/version || exit 1
|
echo "${NEW_VERSION}" > packaging/version || exit 1
|
||||||
echo "::set-output name=run::true"
|
# shellcheck disable=SC2129
|
||||||
echo "::set-output name=message::Update changelog and version for nightly build: ${NEW_VERSION}."
|
echo "run=true" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=ref::master"
|
echo "message=Update changelog and version for nightly build: ${NEW_VERSION}." >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=type::nightly"
|
echo "ref=master" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=branch::master"
|
echo "type=nightly" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=version::nightly"
|
echo "branch=master" >> "${GITHUB_OUTPUT}"
|
||||||
|
echo "version=nightly" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
elif [ "${EVENT_TYPE}" = 'patch' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
elif [ "${EVENT_TYPE}" = 'patch' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
||||||
echo "::notice::Preparing a patch release build."
|
echo "::notice::Preparing a patch release build."
|
||||||
|
@ -130,12 +131,13 @@ elif [ "${EVENT_TYPE}" = 'patch' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
||||||
major_matches || exit 1
|
major_matches || exit 1
|
||||||
check_newer_patch_version || exit 1
|
check_newer_patch_version || exit 1
|
||||||
echo "${EVENT_VERSION}" > packaging/version || exit 1
|
echo "${EVENT_VERSION}" > packaging/version || exit 1
|
||||||
echo "::set-output name=run::true"
|
# shellcheck disable=SC2129
|
||||||
echo "::set-output name=message::Patch release ${EVENT_VERSION}."
|
echo "run=true" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=ref::${EVENT_VERSION}"
|
echo "message=Patch release ${EVENT_VERSION}." >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=type::release"
|
echo "ref=${EVENT_VERSION}" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=branch::${branch_name}"
|
echo "type=release" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
|
echo "branch=${branch_name}" >> "${GITHUB_OUTPUT}"
|
||||||
|
echo "version=$(tr -d 'v' < packaging/version)" >> "${GITHUB_OUTPUT}"
|
||||||
elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
||||||
echo "::notice::Preparing a minor release build."
|
echo "::notice::Preparing a minor release build."
|
||||||
check_version_format || exit 1
|
check_version_format || exit 1
|
||||||
|
@ -149,13 +151,14 @@ elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "${EVENT_VERSION}" > packaging/version || exit 1
|
echo "${EVENT_VERSION}" > packaging/version || exit 1
|
||||||
echo "::set-output name=run::true"
|
# shellcheck disable=SC2129
|
||||||
echo "::set-output name=message::Minor release ${EVENT_VERSION}."
|
echo "run=true" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=ref::${EVENT_VERSION}"
|
echo "message=Minor release ${EVENT_VERSION}." >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=type::release"
|
echo "ref=${EVENT_VERSION}" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=branch::master"
|
echo "type=release" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=new-branch::${branch_name}"
|
echo "branch=master" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
|
echo "new-branch=${branch_name}" >> "${GITHUB_OUTPUT}"
|
||||||
|
echo "version=$(tr -d 'v' < packaging/version)" >> "${GITHUB_OUTPUT}"
|
||||||
elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
||||||
echo "::notice::Preparing a major release build."
|
echo "::notice::Preparing a major release build."
|
||||||
check_version_format || exit 1
|
check_version_format || exit 1
|
||||||
|
@ -164,12 +167,13 @@ elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
|
||||||
check_newer_major_version || exit 1
|
check_newer_major_version || exit 1
|
||||||
check_for_existing_tag || exit 1
|
check_for_existing_tag || exit 1
|
||||||
echo "${EVENT_VERSION}" > packaging/version || exit 1
|
echo "${EVENT_VERSION}" > packaging/version || exit 1
|
||||||
echo "::set-output name=run::true"
|
# shellcheck disable=SC2129
|
||||||
echo "::set-output name=message::Major release ${EVENT_VERSION}"
|
echo "run=true" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=ref::${EVENT_VERSION}"
|
echo "message=Major release ${EVENT_VERSION}" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=type::release"
|
echo "ref=${EVENT_VERSION}" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=branch::master"
|
echo "type=release" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
|
echo "branch=master" >> "${GITHUB_OUTPUT}"
|
||||||
|
echo "version=$(tr -d 'v' < packaging/version)" >> "${GITHUB_OUTPUT}"
|
||||||
else
|
else
|
||||||
echo '::error::Unrecognized release type or invalid version.'
|
echo '::error::Unrecognized release type or invalid version.'
|
||||||
exit 1
|
exit 1
|
||||||
|
|
45
.github/workflows/build.yml
vendored
45
.github/workflows/build.yml
vendored
|
@ -57,7 +57,7 @@ jobs:
|
||||||
--with-math \
|
--with-math \
|
||||||
--with-user=netdata
|
--with-user=netdata
|
||||||
make dist
|
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/
|
cp netdata-*.tar.gz artifacts/
|
||||||
- name: Store
|
- name: Store
|
||||||
id: store
|
id: store
|
||||||
|
@ -183,39 +183,10 @@ jobs:
|
||||||
sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
|
sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
|
||||||
- name: Read build matrix
|
- name: Read build matrix
|
||||||
id: set-matrix
|
id: set-matrix
|
||||||
shell: python3 {0}
|
|
||||||
run: |
|
run: |
|
||||||
from ruamel.yaml import YAML
|
matrix="$(.github/scripts/gen-matrix-build.py)"
|
||||||
import json
|
echo "Generated matrix: ${matrix}"
|
||||||
yaml = YAML(typ='safe')
|
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
|
||||||
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)
|
|
||||||
- name: Failure Notification
|
- name: Failure Notification
|
||||||
uses: rtCamp/action-slack-notify@v2
|
uses: rtCamp/action-slack-notify@v2
|
||||||
env:
|
env:
|
||||||
|
@ -363,7 +334,7 @@ jobs:
|
||||||
id: load
|
id: load
|
||||||
run: |
|
run: |
|
||||||
docker load --input image.tar | tee image-info.txt
|
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 }}
|
- name: Regular build on ${{ matrix.distro }}
|
||||||
id: build-basic
|
id: build-basic
|
||||||
run: |
|
run: |
|
||||||
|
@ -458,7 +429,7 @@ jobs:
|
||||||
id: load
|
id: load
|
||||||
run: |
|
run: |
|
||||||
docker load --input image.tar | tee image-info.txt
|
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 }}
|
- name: Install netdata and run the updater on ${{ matrix.distro }}
|
||||||
id: updater-check
|
id: updater-check
|
||||||
run: |
|
run: |
|
||||||
|
@ -790,9 +761,9 @@ jobs:
|
||||||
id: tag
|
id: tag
|
||||||
run: |
|
run: |
|
||||||
if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
|
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
|
else
|
||||||
echo "::set-output name=tag::${{ github.event.inputs.version }}"
|
echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
upload-release: # Create the draft release and upload the build artifacts.
|
upload-release: # Create the draft release and upload the build artifacts.
|
||||||
|
|
8
.github/workflows/cloud_regression.yml
vendored
8
.github/workflows/cloud_regression.yml
vendored
|
@ -33,10 +33,10 @@ jobs:
|
||||||
NETDATA_CUSTOM_PR_NUMBER=""
|
NETDATA_CUSTOM_PR_NUMBER=""
|
||||||
NETDATA_CUSTOM_COMMIT_HASH="${{ github.sha }}"
|
NETDATA_CUSTOM_COMMIT_HASH="${{ github.sha }}"
|
||||||
fi
|
fi
|
||||||
echo "netdata_repo=${NETDATA_CUSTOM_REPO}" >> $GITHUB_OUTPUT
|
echo "netdata_repo=${NETDATA_CUSTOM_REPO}" >> $GITHUB_OUTPUT
|
||||||
echo "netdata_branch=${NETDATA_CUSTOM_BRANCH}" >> $GITHUB_OUTPUT
|
echo "netdata_branch=${NETDATA_CUSTOM_BRANCH}" >> $GITHUB_OUTPUT
|
||||||
echo "netdata_pr_number=${NETDATA_CUSTOM_PR_NUMBER}" >> $GITHUB_OUTPUT
|
echo "netdata_pr_number=${NETDATA_CUSTOM_PR_NUMBER}" >> $GITHUB_OUTPUT
|
||||||
echo "netdata_commit_hash=${NETDATA_CUSTOM_COMMIT_HASH}" >> $GITHUB_OUTPUT
|
echo "netdata_commit_hash=${NETDATA_CUSTOM_COMMIT_HASH}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Trigger Full Cloud Regression
|
- name: Trigger Full Cloud Regression
|
||||||
uses: aurelien-baudet/workflow-dispatch@v2
|
uses: aurelien-baudet/workflow-dispatch@v2
|
||||||
|
|
18
.github/workflows/codeql.yml
vendored
18
.github/workflows/codeql.yml
vendored
|
@ -32,39 +32,39 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/codeql') }}" = "true" ]; 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.'
|
echo '::notice::Found ci/codeql label, unconditionally running all CodeQL checks.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::true'
|
echo "run=true" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
- name: Check for C/C++ changes
|
- name: Check for C/C++ changes
|
||||||
id: cpp
|
id: cpp
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ steps.always.outputs.run }}" = "false" ]; then
|
if [ "${{ steps.always.outputs.run }}" = "false" ]; then
|
||||||
if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.[ch](xx|\+\+)?' ; 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.'
|
echo '::notice::C/C++ code has changed, need to run CodeQL.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::true'
|
echo "run=true" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
- name: Check for python changes
|
- name: Check for python changes
|
||||||
id: python
|
id: python
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ steps.always.outputs.run }}" = "false" ]; then
|
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
|
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.'
|
echo '::notice::Python code has changed, need to run CodeQL.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::true'
|
echo "run=true" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
analyze-cpp:
|
analyze-cpp:
|
||||||
|
|
4
.github/workflows/docker.yml
vendored
4
.github/workflows/docker.yml
vendored
|
@ -129,9 +129,9 @@ jobs:
|
||||||
id: tag
|
id: tag
|
||||||
run: |
|
run: |
|
||||||
if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
|
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
|
else
|
||||||
echo "::set-output name=tag::${{ github.event.inputs.version }}"
|
echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker-publish:
|
docker-publish:
|
||||||
|
|
64
.github/workflows/packaging.yml
vendored
64
.github/workflows/packaging.yml
vendored
|
@ -44,41 +44,15 @@ jobs:
|
||||||
sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
|
sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
|
||||||
- name: Read build matrix
|
- name: Read build matrix
|
||||||
id: set-matrix
|
id: set-matrix
|
||||||
shell: python3 {0}
|
|
||||||
run: |
|
run: |
|
||||||
from ruamel.yaml import YAML
|
if [ "${{ github.event_name }}" = "pull_request" ] && \
|
||||||
import json
|
[ "${{ !contains(github.event.pull_request.labels.*.name, 'run-ci/packaging') }}" = "true" ]; then
|
||||||
import re
|
matrix="$(.github/scripts/gen-matrix-packaging.py 1)"
|
||||||
import os
|
else
|
||||||
ALWAYS_RUN_ARCHES = ["amd64", "x86_64"]
|
matrix="$(.github/scripts/gen-matrix-packaging.py 0)"
|
||||||
yaml = YAML(typ='safe')
|
fi
|
||||||
entries = list()
|
echo "Generated matrix: ${matrix}"
|
||||||
run_limited = False
|
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
|
||||||
|
|
||||||
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)
|
|
||||||
- name: Failure Notification
|
- name: Failure Notification
|
||||||
uses: rtCamp/action-slack-notify@v2
|
uses: rtCamp/action-slack-notify@v2
|
||||||
env:
|
env:
|
||||||
|
@ -117,24 +91,24 @@ jobs:
|
||||||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||||
case "${{ github.event.inputs.type }}" in
|
case "${{ github.event.inputs.type }}" in
|
||||||
"release")
|
"release")
|
||||||
echo "::set-output name=repo::${REPO_PREFIX}"
|
echo "repo=${REPO_PREFIX}" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=version::${{ github.event.inputs.version }}"
|
echo "version=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=retention::365"
|
echo "retention=365" >> "${GITHUB_OUTPUT}"
|
||||||
;;
|
;;
|
||||||
"nightly")
|
"nightly")
|
||||||
echo "::set-output name=repo::${REPO_PREFIX}-edge"
|
echo "repo=${REPO_PREFIX}-edge" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
|
echo "version=$(tr -d 'v' < packaging/version)" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=retention::30"
|
echo "retention=30" >> "${GITHUB_OUTPUT}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "::set-output name=repo::${REPO_PREFIX}-devel"
|
echo "repo=${REPO_PREFIX}-devel" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=version::0.${GITHUB_SHA}"
|
echo "version=0.${GITHUB_SHA}" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=retention::30"
|
echo "retention=30" >> "${GITHUB_OUTPUT}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
echo "::set-output name=version::$(cut -d'-' -f 1 packaging/version | tr -d 'v')"
|
echo "version=$(cut -d'-' -f 1 packaging/version | tr -d 'v')" >> "${GITHUB_OUTPUT}"
|
||||||
echo "::set-output name=retention::0"
|
echo "retention=0" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
- name: Failure Notification
|
- name: Failure Notification
|
||||||
uses: rtCamp/action-slack-notify@v2
|
uses: rtCamp/action-slack-notify@v2
|
||||||
|
|
27
.github/workflows/repoconfig-packages.yml
vendored
27
.github/workflows/repoconfig-packages.yml
vendored
|
@ -34,31 +34,10 @@ jobs:
|
||||||
sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
|
sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
|
||||||
- name: Read build matrix
|
- name: Read build matrix
|
||||||
id: set-matrix
|
id: set-matrix
|
||||||
shell: python3 {0}
|
|
||||||
run: |
|
run: |
|
||||||
from ruamel.yaml import YAML
|
matrix="$(.github/scripts/gen-matrix-repoconfig.py)"
|
||||||
import json
|
echo "Generated matrix: ${matrix}"
|
||||||
yaml = YAML(typ='safe')
|
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
|
||||||
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)
|
|
||||||
- name: Failure Notification
|
- name: Failure Notification
|
||||||
uses: rtCamp/action-slack-notify@v2
|
uses: rtCamp/action-slack-notify@v2
|
||||||
env:
|
env:
|
||||||
|
|
30
.github/workflows/review.yml
vendored
30
.github/workflows/review.yml
vendored
|
@ -29,56 +29,56 @@ jobs:
|
||||||
id: actionlint
|
id: actionlint
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/actionlint') }}" = "true" ]; then
|
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
|
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.'
|
echo 'GitHub Actions workflows have changed, need to run actionlint.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
- name: Check files for eslint
|
- name: Check files for eslint
|
||||||
id: eslint
|
id: eslint
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/eslint') }}" = "true" ]; then
|
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
|
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.'
|
echo 'JS files have changed, need to run ESLint.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
- name: Check files for hadolint
|
- name: Check files for hadolint
|
||||||
id: hadolint
|
id: hadolint
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/hadolint') }}" = "true" ]; then
|
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
|
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.'
|
echo 'Dockerfiles have changed, need to run Hadolint.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
- name: Check files for shellcheck
|
- name: Check files for shellcheck
|
||||||
id: shellcheck
|
id: shellcheck
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/shellcheck') }}" = "true" ]; then
|
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
|
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.'
|
echo 'Shell scripts have changed, need to run shellcheck.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
- name: Check files for yamllint
|
- name: Check files for yamllint
|
||||||
id: yamllint
|
id: yamllint
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/yamllint') }}" = "true" ]; then
|
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
|
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.'
|
echo 'YAML files have changed, need to run yamllint.'
|
||||||
else
|
else
|
||||||
echo '::set-output name=run::false'
|
echo "run=false" >> "${GITHUB_OUTPUT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
actionlint:
|
actionlint:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue