2024-01-20 01:34:17 +08:00
|
|
|
variables:
|
|
|
|
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: "true"
|
|
|
|
# renovate: datasource=gitlab-releases depName=gitlab-org/cli
|
2024-07-20 18:14:13 +08:00
|
|
|
GLAB_VERSION: 1.45.0
|
2024-01-20 01:34:17 +08:00
|
|
|
# renovate: datasource=docker depName=aclemons/sbo-maintainer-tools versioning=docker
|
2024-07-20 18:14:13 +08:00
|
|
|
SBO_MAINTAINER_TOOLS_IMAGE: aclemons/sbo-maintainer-tools:0.9.1-15.0@sha256:7a961b60a487ecd3e6171f4e7e7ee7c8f659fdc6a37aac26ae2dcd5a3cb8414f
|
2024-01-20 01:34:17 +08:00
|
|
|
|
|
|
|
workflow:
|
|
|
|
rules:
|
|
|
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
|
|
|
|
|
|
|
default:
|
2024-08-18 14:46:49 +08:00
|
|
|
image: docker:27.2.0@sha256:f9f72ad901a78f27be922b2d320bbc263174f12919c1b37e6a01f828fa904565
|
2024-01-20 01:34:17 +08:00
|
|
|
services:
|
2024-08-18 14:46:49 +08:00
|
|
|
- docker:27.2.0-dind@sha256:f9f72ad901a78f27be922b2d320bbc263174f12919c1b37e6a01f828fa904565
|
2024-01-20 01:34:17 +08:00
|
|
|
|
|
|
|
pr-checks:
|
|
|
|
script: |
|
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
apk add git
|
|
|
|
|
|
|
|
wget --quiet "https://gitlab.com/gitlab-org/cli/-/releases/v$GLAB_VERSION/downloads/glab_""$GLAB_VERSION""_Linux_x86_64.tar.gz"
|
|
|
|
tar -xf "glab_""$GLAB_VERSION""_Linux_x86_64.tar.gz" bin/glab
|
|
|
|
chmod 0755 bin/glab
|
|
|
|
mv bin/glab /usr/local/bin
|
|
|
|
rm -rf bin
|
|
|
|
|
|
|
|
docker pull "$SBO_MAINTAINER_TOOLS_IMAGE"
|
|
|
|
|
|
|
|
git diff-tree --name-only --diff-filter=d --no-commit-id -r $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA | sed '/^\./d' | sed -n '/[^\/][^\/]*\/[^\/][^\/]*\//p' | xargs -I xx dirname xx | sort -u | while read -r project ; do
|
|
|
|
mkfifo pipe
|
|
|
|
tee sbolint-output < pipe &
|
|
|
|
exec 3>pipe
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
|
|
|
docker run --rm -v "$(pwd):/work" -w /work "$SBO_MAINTAINER_TOOLS_IMAGE" sbolint "$project" >&3 2>&1
|
|
|
|
sbolint_status="$?"
|
|
|
|
set -e
|
|
|
|
|
|
|
|
exec 3>&-
|
|
|
|
rm pipe
|
|
|
|
|
|
|
|
{
|
|
|
|
if [[ "$sbolint_status" -eq 0 ]] ; then
|
|
|
|
printf '#### ✅ sbolint - %s\n\n' "$project ✅"
|
|
|
|
else
|
|
|
|
printf '#### ⛔️ sbolint - %s\n\n' "$project ⛔️"
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf '```\n'
|
|
|
|
cat sbolint-output
|
|
|
|
rm sbolint-output
|
|
|
|
printf '```\n'
|
|
|
|
} > comment-output
|
|
|
|
|
2024-02-03 08:23:23 +08:00
|
|
|
if [ -z "$MR_AUTOMATION_TOKEN" ] ; then
|
|
|
|
printf 'No token available for MR comments\n'
|
|
|
|
cat comment-output
|
|
|
|
else
|
|
|
|
# $CI_PROJECT_PATH points to the fork
|
|
|
|
GITLAB_TOKEN="$MR_AUTOMATION_TOKEN" glab mr --repo "SlackBuilds.org/slackbuilds" comment $(echo "$CI_OPEN_MERGE_REQUESTS" | cut -d '!' -f2) --unique=true --message "$(cat comment-output)"
|
|
|
|
fi
|
2024-01-20 01:34:17 +08:00
|
|
|
done
|
2024-04-08 19:27:05 +08:00
|
|
|
|
|
|
|
git diff-tree --name-only --diff-filter=d --no-commit-id -r $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA | sed '/^\./d' | sed -n '/[^\/][^\/]*\/[^\/][^\/]*\//p' | xargs -I xx dirname xx | sort -u | while read -r project ; do
|
|
|
|
short_project="$(printf '%s\n' "$project" | cut -d/ -f2)"
|
|
|
|
response="$(wget -q -O - "https://slackbuilds.org/revdeps.php?q=$short_project" | sort)"
|
|
|
|
|
|
|
|
{
|
|
|
|
printf '#### reverse dependencies - %s\n\n' "$project"
|
|
|
|
if [[ "$response" == "" ]] ; then
|
|
|
|
printf 'None\n'
|
|
|
|
else
|
2024-06-01 12:46:41 +08:00
|
|
|
printf '%s\n' "$response" | sort | sed 's/^/- [ ] /'
|
2024-04-08 19:27:05 +08:00
|
|
|
fi
|
|
|
|
} > comment-output
|
|
|
|
|
|
|
|
if [ -z "$MR_AUTOMATION_TOKEN" ] ; then
|
|
|
|
printf 'No token available for MR comments\n'
|
|
|
|
cat comment-output
|
|
|
|
else
|
|
|
|
# $CI_PROJECT_PATH points to the fork
|
|
|
|
GITLAB_TOKEN="$MR_AUTOMATION_TOKEN" glab mr --repo "SlackBuilds.org/slackbuilds" comment $(echo "$CI_OPEN_MERGE_REQUESTS" | cut -d '!' -f2) --unique=true --message "$(cat comment-output)"
|
|
|
|
fi
|
|
|
|
done
|