From 750877a95988e7d6b8196886d85674373e82537b Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Wed, 21 Aug 2024 13:19:29 -0300 Subject: [PATCH 1/8] Avoid using python-gitlab.cfg In order to simply configuration and to avoid duplication drop the use of python-gitlab.cfg by specifying settings from command line. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- .gitlab-ci/branching.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci/branching.yml b/.gitlab-ci/branching.yml index 52a610f..78e815a 100644 --- a/.gitlab-ci/branching.yml +++ b/.gitlab-ci/branching.yml @@ -5,6 +5,7 @@ branch-protection-relax: extends: .custom_globals_default variables: RULES: gitlab-scripts/rulez-relax.yaml + ARGS: --gitlab-server-url ${CI_SERVER_URL} --gitlab-api-token ${GITLAB_TOKEN} stage: branch-protection-relax needs: - explain-done @@ -14,18 +15,17 @@ branch-protection-relax: - apt install -y --no-install-recommends gitlab-rulez/bookworm-backports # required to avoid python deprecation warnings script: - - export PYTHON_GITLAB_CFG=${PYTHON_GITLAB_CFG:-$PYTHON_GITLAB} - test "$NOACT" -eq 1 && ACTION=diff || ACTION=apply # ignore gitlab-rulez telling us "I found some diffs compare to the desired state" # since it is indeed something expected by design when running with NOACT=1 - - gitlab-rulez "$ACTION" --filter 'pkg/*' $RULES || test "$?" -eq 10 - - gitlab-rulez "$ACTION" --filter 'infrastructure/*' $RULES || test "$?" -eq 10 - - gitlab-rulez "$ACTION" --filter 'tests/*' $RULES || test "$?" -eq 10 - - gitlab-rulez "$ACTION" --filter 'apertis/*' $RULES || test "$?" -eq 10 - - gitlab-rulez "$ACTION" --filter 'appfw/*' $RULES || test "$?" -eq 10 - - gitlab-rulez "$ACTION" --filter 'docs/*' $RULES || test "$?" -eq 10 - - gitlab-rulez "$ACTION" --filter 'hmi/*' $RULES || test "$?" -eq 10 - - gitlab-rulez "$ACTION" --filter 'sample-applications/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'pkg/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'infrastructure/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'tests/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'apertis/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'appfw/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'docs/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'hmi/*' $RULES || test "$?" -eq 10 + - gitlab-rulez $ARGS "$ACTION" --filter 'sample-applications/*' $RULES || test "$?" -eq 10 branch-update-image-recipes: extends: .custom_globals_default @@ -100,7 +100,6 @@ branch-mass-create-branches: curl ca-certificates git - - cat ${PYTHON_GITLAB} > /root/.python-gitlab.cfg script: - cd release-scripts - test "$NOACT" -eq 1 && DRY_RUN=--dry-run || DRY_RUN= @@ -115,6 +114,8 @@ branch-mass-create-branches: --filter 'hmi/*' --filter 'infrastructure/*' --filter 'pkg/*' + --gitlab-server-url ${CI_SERVER_URL} + --gitlab-api-token ${GITLAB_TOKEN} $DRY_RUN branch-update-tests-projects: -- GitLab From 8d84fa7def44e65d36d0255c74a3c383ea489217 Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Wed, 21 Aug 2024 13:26:15 -0300 Subject: [PATCH 2/8] Switch to iterator=True on python-gitlab Since as_list will be deprecated soon, switch to the equivalent iterator=True. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- release-scripts/create-branches | 2 +- release-scripts/delete-branches | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/release-scripts/create-branches b/release-scripts/create-branches index 5dd77c9..0706be4 100755 --- a/release-scripts/create-branches +++ b/release-scripts/create-branches @@ -202,7 +202,7 @@ class Brancher: projects.extend(p) total_pages = self.gl.projects.list( - as_list=False, per_page=per_page, **kwargs + iterator=True, per_page=per_page, **kwargs ).total_pages thread_pool( num_worker_threads, _fetch_page, range(1, total_pages + 1), num_retries=2 diff --git a/release-scripts/delete-branches b/release-scripts/delete-branches index 1bd870c..3beb087 100755 --- a/release-scripts/delete-branches +++ b/release-scripts/delete-branches @@ -112,7 +112,7 @@ class Brancher: projects.extend(p) total_pages = self.gl.projects.list( - as_list=False, per_page=per_page, **kwargs + iterator=True, per_page=per_page, **kwargs ).total_pages thread_pool( num_worker_threads, _fetch_page, range(1, total_pages + 1), num_retries=2 -- GitLab From 41fed1b11982635e72f0df7dace9fe85408893e7 Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Wed, 21 Aug 2024 13:35:07 -0300 Subject: [PATCH 3/8] Move gitlab rulez to its own folder To make things more tidy move gitlab rulez to its own repo. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- .gitlab-ci/branching.yml | 6 +++--- {gitlab-scripts => gitlab-rulez}/rulez-relax.yaml | 0 {gitlab-scripts => gitlab-rulez}/rulez.yaml | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename {gitlab-scripts => gitlab-rulez}/rulez-relax.yaml (100%) rename {gitlab-scripts => gitlab-rulez}/rulez.yaml (100%) diff --git a/.gitlab-ci/branching.yml b/.gitlab-ci/branching.yml index 78e815a..7e75a6f 100644 --- a/.gitlab-ci/branching.yml +++ b/.gitlab-ci/branching.yml @@ -4,7 +4,7 @@ include: branch-protection-relax: extends: .custom_globals_default variables: - RULES: gitlab-scripts/rulez-relax.yaml + RULES: gitlab-rulez/rulez-relax.yaml ARGS: --gitlab-server-url ${CI_SERVER_URL} --gitlab-api-token ${GITLAB_TOKEN} stage: branch-protection-relax needs: @@ -130,7 +130,7 @@ branch-protection-tighten: stage: branch-protection-tighten allow_failure: true variables: - RULES: gitlab-scripts/rulez.yaml + RULES: gitlab-rulez/rulez.yaml needs: - branch-protection-relax before_script: @@ -139,7 +139,7 @@ branch-protection-tighten: - apt install -y --no-install-recommends sed gitlab-rulez/bookworm-backports # required to avoid python deprecation warnings - - sed -i "s/$RELEASE/$NEXT_RELEASE/g" gitlab-scripts/rulez.yaml + - sed -i "s/$RELEASE/$NEXT_RELEASE/g" gitlab-rulez/rulez.yaml rules: - if: $CI_JOB_NAME =~ $FORCE_JOB_RUN when: manual diff --git a/gitlab-scripts/rulez-relax.yaml b/gitlab-rulez/rulez-relax.yaml similarity index 100% rename from gitlab-scripts/rulez-relax.yaml rename to gitlab-rulez/rulez-relax.yaml diff --git a/gitlab-scripts/rulez.yaml b/gitlab-rulez/rulez.yaml similarity index 100% rename from gitlab-scripts/rulez.yaml rename to gitlab-rulez/rulez.yaml -- GitLab From 06c2b48140018e5c1a79ef900a92f602ee994cce Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Wed, 21 Aug 2024 13:43:27 -0300 Subject: [PATCH 4/8] Drop unmaintained scripts The fold gitlab-scripts contains a set of unmaintained scripts. These scripts have not been used for ages and make use of Gitlab APIs that are not longer valid. In this context, they don't have much value, and can always be checked in git history if needed. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- gitlab-scripts/README.md | 64 ----- gitlab-scripts/add-collaborans-to-groups | 57 ----- gitlab-scripts/add-user-to-group | 24 -- gitlab-scripts/collabora-guest-groups | 4 - gitlab-scripts/collabora-master-groups | 10 - gitlab-scripts/common.sh | 14 -- gitlab-scripts/edit-group-user | 45 ---- gitlab-scripts/edit-settings | 5 - gitlab-scripts/edit-user | 17 -- gitlab-scripts/get-bosch-users | 9 - gitlab-scripts/get-collabora-users | 9 - gitlab-scripts/get-groups | 12 - gitlab-scripts/get-user | 25 -- gitlab-scripts/get-users | 12 - gitlab-scripts/gitlab | 20 -- gitlab-scripts/groups | 15 -- gitlab-scripts/make-boschlers-internal | 49 ---- gitlab-scripts/make-collaborans-internal | 49 ---- gitlab-scripts/remove-collaborans-from-groups | 31 --- .../server-side/convert-map-to-apache | 33 --- gitlab-scripts/server-side/disable-repository | 52 ---- gitlab-scripts/server-side/ls-not-migrated | 25 -- .../server-side/ls-not-migrated-internal | 25 -- gitlab-scripts/server-side/migrate-repo | 225 ------------------ gitlab-scripts/server-side/migrated-map | 197 --------------- gitlab-scripts/server-side/move-project | 7 - gitlab-scripts/server-side/print-migrated-map | 29 --- gitlab-scripts/share-with-collabora | 1 - gitlab-scripts/shared-projects | 86 ------- 29 files changed, 1151 deletions(-) delete mode 100644 gitlab-scripts/README.md delete mode 100755 gitlab-scripts/add-collaborans-to-groups delete mode 100755 gitlab-scripts/add-user-to-group delete mode 100644 gitlab-scripts/collabora-guest-groups delete mode 100644 gitlab-scripts/collabora-master-groups delete mode 100644 gitlab-scripts/common.sh delete mode 100755 gitlab-scripts/edit-group-user delete mode 100644 gitlab-scripts/edit-settings delete mode 100755 gitlab-scripts/edit-user delete mode 100755 gitlab-scripts/get-bosch-users delete mode 100755 gitlab-scripts/get-collabora-users delete mode 100755 gitlab-scripts/get-groups delete mode 100755 gitlab-scripts/get-user delete mode 100755 gitlab-scripts/get-users delete mode 100755 gitlab-scripts/gitlab delete mode 100644 gitlab-scripts/groups delete mode 100755 gitlab-scripts/make-boschlers-internal delete mode 100755 gitlab-scripts/make-collaborans-internal delete mode 100644 gitlab-scripts/remove-collaborans-from-groups delete mode 100755 gitlab-scripts/server-side/convert-map-to-apache delete mode 100755 gitlab-scripts/server-side/disable-repository delete mode 100755 gitlab-scripts/server-side/ls-not-migrated delete mode 100755 gitlab-scripts/server-side/ls-not-migrated-internal delete mode 100755 gitlab-scripts/server-side/migrate-repo delete mode 100644 gitlab-scripts/server-side/migrated-map delete mode 100755 gitlab-scripts/server-side/move-project delete mode 100755 gitlab-scripts/server-side/print-migrated-map delete mode 100644 gitlab-scripts/share-with-collabora delete mode 100644 gitlab-scripts/shared-projects diff --git a/gitlab-scripts/README.md b/gitlab-scripts/README.md deleted file mode 100644 index 2ef6b00..0000000 --- a/gitlab-scripts/README.md +++ /dev/null @@ -1,64 +0,0 @@ -Apertis GitLab tools --------------------- - -|Script | Description -|------------------------- | -------------------------------------------------- -|add-collaborans-to-groups | Add Collabora users to the groups listed in -| | collabora-master-groups and collabora-guest-groups -|add-user-to-group | Add a user to a groups with the specified -| | access level -|edit-group-user | Show or edit the access levels of a user -| | in a group -|edit-user | Edit settings in the user’s profile -|get-bosch-users | Get all users with addresses ending with bosch.com -|get-collabora-users | Get all users with addresses ending with -| | collabora.co.uk as pretty-printed JSON -|get-groups | Get the list of the groups -|get-user | Get the JSON of the user’s profile -|get-users | Get the list of all users in JSON -|gitlab | Talk to the Apertis GitLab -|make-boschlers-internal | Make Bosch users internal and add them to "bosch" -| | and "apertis-developers" as Developers -|make-collaborans-internal | Make Collabora users internal and add them to -| | "collabora" and "apertis-developers" as Masters - - -GitLab tokens -============= - -All scripts expect a file: - - ~/.gitlab-apertis-org-token - -with the following contents: - - GITLAB_TOKEN=your-gitlab-token - -You can generate the token in [your profile][1]. - -[1]: https://gitlab.apertis.org/profile/personal_access_tokens - -Server-side scripts -=================== - -Server-side scripts are aimed to do the migration procedures at the original -Git server. You need shell access to the server, preferrably as root. In -`migrate-repo`, edit `ALIOTH_BASE_URL=` to point to the original Git server -(including the password), so that GitLab can clone the repositories, and -make sure `GITLAB_TOKEN` environment variable is set. - -In `disable_repo` function, edit the notice which will be displayed to the -users attempting to clone the original repo. Similar edits will be necessary -in `disable-repository` if you use it. - -`ls-not-migrated` and `ls-not-migrated-internal` list repositories which -don’t seem to have been already migrated, and print commands necessary to -migrate them. - -`print-migrated-map` produces a report on where the repositories have been -migrated to, which `convert-map-to-apache` can later convert to an Apache -redirection file (**WARNING**: `+` in the names of repositories isn’t -handled properly, certain names e.g. `gtk+` will need manual fixups). - -All of these scripts will most likely need readjustments for a different -server configuration. diff --git a/gitlab-scripts/add-collaborans-to-groups b/gitlab-scripts/add-collaborans-to-groups deleted file mode 100755 index 7264ba8..0000000 --- a/gitlab-scripts/add-collaborans-to-groups +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -# Add Collabora users to the groups listed in collabora-master-groups and collabora-guest-groups - -. ./common.sh - -PATH=.:$PATH - -collaborans="$(get-collabora-users | jq -r .[].id)" - -add_or_edit() { - group=$1 - user=$2 - access_level=$3 - - old_access_level="$(edit-group-user $group $user | jq -r .access_level)" - if [ "$old_access_level" != null ] - then - # user already in the group - if [ "$old_access_level" != "$access_level" ] - then - edit-group-user $group $user $access_level - fi - else - add-user-to-group $group $user $access - fi -} - -# 10 => Guest access -# 20 => Reporter access -# 30 => Developer access -# 40 => Master access -# 50 => Owner access # Only valid for groups - -groups="$(cat collabora-master-groups)" - -access=40 - -for c in $collaborans -do - for g in $groups - do - add_or_edit $g $c $access - done -done - -groups="$(cat collabora-guest-groups)" - -access=10 - -for c in $collaborans -do - for g in $groups - do - add_or_edit $g $c $access - done -done diff --git a/gitlab-scripts/add-user-to-group b/gitlab-scripts/add-user-to-group deleted file mode 100755 index fd9b84a..0000000 --- a/gitlab-scripts/add-user-to-group +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# Add a user to a groups with the specified access level -group=$1 -user=$2 -access=$3 -# -# Access levels: -# 10 => Guest access -# 20 => Reporter access -# 30 => Developer access -# 40 => Master access -# 50 => Owner access (only valid for groups) - -. ./common.sh - -. ~/.gitlab-apertis-org-token - -API=https://gitlab.apertis.org/api/v4 - -request=POST - -curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request $request $API/groups/$group/members -d user_id=$user -d access_level=$access - diff --git a/gitlab-scripts/collabora-guest-groups b/gitlab-scripts/collabora-guest-groups deleted file mode 100644 index fa82616..0000000 --- a/gitlab-scripts/collabora-guest-groups +++ /dev/null @@ -1,4 +0,0 @@ -attic -bos00018 -car-demo -staging diff --git a/gitlab-scripts/collabora-master-groups b/gitlab-scripts/collabora-master-groups deleted file mode 100644 index 0809f96..0000000 --- a/gitlab-scripts/collabora-master-groups +++ /dev/null @@ -1,10 +0,0 @@ -adit-gen3 -apertis -apertis-developers -appfw -docs -hmi -infrastructure -packaging -sample-applications -third-party diff --git a/gitlab-scripts/common.sh b/gitlab-scripts/common.sh deleted file mode 100644 index 159981d..0000000 --- a/gitlab-scripts/common.sh +++ /dev/null @@ -1,14 +0,0 @@ -help() { - echo Usage: - printf " %s " $0 - echo $(sed -n '2,/\. .*common.sh$/ {/=\$/p}' $0 | cut -d= -f1 | tr a-z A-Z) - echo - sed -n '2,/\. .*common.sh$/ {/^# /{s/^# //g;p}}' $0 -} - -# Show help if --help is passed or parameters needed and none given -if [ "$1" = --help ] || [ $# -lt 1 -a $(sed -n '2,/\. .*common.sh$/ {/=\$/p}' $0 | wc -l) -ne 0 ] -then - help >&2 - exit 1 -fi diff --git a/gitlab-scripts/edit-group-user b/gitlab-scripts/edit-group-user deleted file mode 100755 index 94feb81..0000000 --- a/gitlab-scripts/edit-group-user +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -# Show or edit the access levels of a user in a group -group=$1 -user=$2 -access=$3 -# -# The user needs to be specified by a numeric ID -# -# If access level is specified, can be any of: -# 10 => Guest access -# 20 => Reporter access -# 30 => Developer access -# 40 => Master access -# 50 => Owner access (only valid for groups) -# -# or "delete" to remove the user from the group -# -# If the access level is omitter, dumps the JSON of the membership record - -. ./common.sh - -. ~/.gitlab-apertis-org-token - -API=https://gitlab.apertis.org/api/v4 - -group=$1 -user=$2 -access=$3 - -if [ -n "$access" ] && [ "$access" != delete ] -then - request=PUT - query="?access_level=$access" -else - if [ "$access" = delete ] - then - request=DELETE - else - request=GET - fi -fi - -curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request $request $API/groups/$group/members/$user$query - diff --git a/gitlab-scripts/edit-settings b/gitlab-scripts/edit-settings deleted file mode 100644 index 7f3a033..0000000 --- a/gitlab-scripts/edit-settings +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# An example how to mass-edit project settings - -for p in $(cat shared-projects); do request=PUT ./gitlab /projects/$p -d merge_method=ff; done diff --git a/gitlab-scripts/edit-user b/gitlab-scripts/edit-user deleted file mode 100755 index d57f1a6..0000000 --- a/gitlab-scripts/edit-user +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Edit settings in the user’s profile -user=$1 -key=$2 -value=$3 - -. ./common.sh - -. ~/.gitlab-apertis-org-token - -API=https://gitlab.apertis.org/api/v4 - -request=PUT - -curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request $request $API/users/$user -d $key=$value - diff --git a/gitlab-scripts/get-bosch-users b/gitlab-scripts/get-bosch-users deleted file mode 100755 index d4df372..0000000 --- a/gitlab-scripts/get-bosch-users +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Get all users with addresses ending with bosch.com - -. ./common.sh - -PATH=.:$PATH - -get-users | jq '[.[] | select(.email | endswith("bosch.com")) | { id: .id, username: .username, email: .email }]' diff --git a/gitlab-scripts/get-collabora-users b/gitlab-scripts/get-collabora-users deleted file mode 100755 index 0f9b74a..0000000 --- a/gitlab-scripts/get-collabora-users +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Get all users with addresses ending with collabora.co.uk as pretty-printed JSON - -. ./common.sh - -PATH=.:$PATH - -get-users | jq '[.[] | select(.email | endswith("@collabora.co.uk")) | { id: .id, username: .username, email: .email }]' diff --git a/gitlab-scripts/get-groups b/gitlab-scripts/get-groups deleted file mode 100755 index 901cc10..0000000 --- a/gitlab-scripts/get-groups +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Get the list of the groups - -. ./common.sh - -. ~/.gitlab-apertis-org-token - -API=https://gitlab.apertis.org/api/v4 - -curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request GET $API/groups | jq -r '.[].path' - diff --git a/gitlab-scripts/get-user b/gitlab-scripts/get-user deleted file mode 100755 index cc35deb..0000000 --- a/gitlab-scripts/get-user +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# Get the JSON of the user’s profile -user=$1 -key=$2 -# -# USER is the numeric id of the user -# KEY is an optional argument to print just one setting - -. ./common.sh - -. ~/.gitlab-apertis-org-token - -API=https://gitlab.apertis.org/api/v4 - -request=GET - -if [ -n "$key" ] -then - curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request $request $API/users/$user $filter | jq -r .$key -else - curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request $request $API/users/$user $filter -fi - - diff --git a/gitlab-scripts/get-users b/gitlab-scripts/get-users deleted file mode 100755 index 3aa6fbf..0000000 --- a/gitlab-scripts/get-users +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Get the list of all users in JSON - -. ./common.sh - -. ~/.gitlab-apertis-org-token - -API=https://gitlab.apertis.org/api/v4 - -curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request GET $API/users - diff --git a/gitlab-scripts/gitlab b/gitlab-scripts/gitlab deleted file mode 100755 index 1c3cb14..0000000 --- a/gitlab-scripts/gitlab +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Talk to the Apertis GitLab -URL=$1 -# -# A tool to send generic requests to the Apertis GitLab instance -# Use the "request" environment variable to set the request type -# (GET, PUT, POST, DELETE...; GET is the default) -# -# The first argument is the API resource, the rest is passed to -# cURL as is. - -. ./common.sh - -. ~/.gitlab-apertis-org-token - -API=https://gitlab.apertis.org/api/v4 -shift - -curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request ${request:-GET} $API$URL "$@" diff --git a/gitlab-scripts/groups b/gitlab-scripts/groups deleted file mode 100644 index 1660d91..0000000 --- a/gitlab-scripts/groups +++ /dev/null @@ -1,15 +0,0 @@ -collabora -adit-gen3 -apertis -appfw -attic -bos00018 -car-demo -docs -hmi -infrastructure -internal -packaging -sample-applications -staging -third-party diff --git a/gitlab-scripts/make-boschlers-internal b/gitlab-scripts/make-boschlers-internal deleted file mode 100755 index 18f92e0..0000000 --- a/gitlab-scripts/make-boschlers-internal +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# Make Bosch users internal and add them to "bosch" and "apertis-developers" as Developers - -. ./common.sh - -PATH=.:$PATH - -collaborans="$(get-bosch-users | jq -r .[].id)" - -add_or_edit() { - group=$1 - user=$2 - access_level=$3 - - old_access_level="$(edit-group-user $group $user | jq -r .access_level)" - if [ "$old_access_level" != null ] - then - # user already in the group - if [ "$old_access_level" != "$access_level" ] - then - edit-group-user $group $user $access_level - fi - else - add-user-to-group $group $user $access - fi -} - -# 10 => Guest access -# 20 => Reporter access -# 30 => Developer access -# 40 => Master access -# 50 => Owner access # Only valid for groups - -access=30 - -for c in $collaborans -do - e=$(get-user $c external) - if [ "$e" != false ] - then - edit-user $c external false | jq - else - echo "skipping internal user $(get-user $c username)" - fi - add_or_edit bosch $c $access | jq - add_or_edit apertis-developers $c $access | jq -done - diff --git a/gitlab-scripts/make-collaborans-internal b/gitlab-scripts/make-collaborans-internal deleted file mode 100755 index 1fb918c..0000000 --- a/gitlab-scripts/make-collaborans-internal +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# Make Collabora users internal and add them to "collabora" and "apertis-developers" as Masters - -. ./common.sh - -PATH=.:$PATH - -collaborans="$(get-collabora-users | jq -r .[].id)" - -add_or_edit() { - group=$1 - user=$2 - access_level=$3 - - old_access_level="$(edit-group-user $group $user | jq -r .access_level)" - if [ "$old_access_level" != null ] - then - # user already in the group - if [ "$old_access_level" != "$access_level" ] - then - edit-group-user $group $user $access_level - fi - else - add-user-to-group $group $user $access - fi -} - -# 10 => Guest access -# 20 => Reporter access -# 30 => Developer access -# 40 => Master access -# 50 => Owner access # Only valid for groups - -access=40 - -for c in $collaborans -do - e=$(get-user $c external) - if [ "$e" != false ] - then - edit-user $c external false | jq - else - echo "skipping internal user $(get-user $c username)" - fi - add_or_edit collabora $c $access | jq - add_or_edit apertis-developers $c $access | jq -done - diff --git a/gitlab-scripts/remove-collaborans-from-groups b/gitlab-scripts/remove-collaborans-from-groups deleted file mode 100644 index 67438d7..0000000 --- a/gitlab-scripts/remove-collaborans-from-groups +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -PATH=.:$PATH - -collaborans="$(get-collabora-users | jq -r .[].id)" - -# 10 => Guest access -# 20 => Reporter access -# 30 => Developer access -# 40 => Master access -# 50 => Owner access # Only valid for groups - -groups="$(cat collabora-master-groups)" - -for c in $collaborans -do - for g in $groups - do - edit-group-user $g $c delete - done -done - -groups="$(cat collabora-guest-groups)" - -for c in $collaborans -do - for g in $groups - do - edit-group-user $g $c delete - done -done diff --git a/gitlab-scripts/server-side/convert-map-to-apache b/gitlab-scripts/server-side/convert-map-to-apache deleted file mode 100755 index cd6fad1..0000000 --- a/gitlab-scripts/server-side/convert-map-to-apache +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -while read repo url -do - base=$(echo $repo | cut -d / -f 2) - rest=${repo#/$base/} - host=git - if [ "$base" != git ] - then - host=git.$base - fi - head=$(cat $repo.git/HEAD) - headref=${head##*refs/heads/} - cat << EOF -RewriteCond %{SERVER_NAME} =$host.apertis.org [NC] -RewriteCond %{QUERY_STRING} ^id=(\w+)$ -RewriteRule ^/c?git/$rest.git/commit/\$ $url/commit/%1? [last,noescape,redirect=permanent] - -RewriteCond %{SERVER_NAME} =$host.apertis.org [NC] -RewriteRule ^/c?git/$rest(?:\.git)?(/|/tree/)?\$ $url [last,noescape,redirect=permanent] - -RewriteCond %{SERVER_NAME} =$host.apertis.org [NC] -RewriteRule ^/c?git/$rest(?:\.git)?/info/(.*)\$ $url.git/info/\$1 [last,noescape,redirect=permanent] - -RewriteCond %{SERVER_NAME} =$host.apertis.org [NC] -RewriteRule ^/c?git/$rest(?:\.git)?/tree/(.*)\$ $url/tree/$headref/\$1 [last,noescape,redirect=permanent] - -RewriteCond %{SERVER_NAME} =$host.apertis.org [NC] -RewriteRule ^/$base/$rest(?:\.git)?/(.*) $url/\$1 [last,noescape,redirect=permanent] - -EOF - -done diff --git a/gitlab-scripts/server-side/disable-repository b/gitlab-scripts/server-side/disable-repository deleted file mode 100755 index 1a8b340..0000000 --- a/gitlab-scripts/server-side/disable-repository +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -path=$1 -gitlab_path=$2 - -if [ ! -d "$path/hooks" ]; then - echo "ERROR: $path does not have any hooks sub-directory" - exit 1 -fi - -if [ -z "$gitlab_path" ]; then - echo "ERROR: you need to provide the gitlab path as second paramater" - echo "Usage: $0 <path-to-git-repo> <gitlab-path>" - exit 1 -fi - -if [ -x "$path/hooks/pre-receive" ]; then - echo "WARNING: pre-receive hook in place already" - echo -n "Do you want to overwrite ? [yN] " - read answer - if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then - echo "Aborting." - exit 1 - fi -fi - -cat > $path/description <<END -This repository was moved to gitlab.apertis.org: -https://gitlab.apertis.org/$gitlab_path - -Push refused, this repository was archived. Please update your -remotes to use the following URL instead: - -git@gitlab.apertis.org:$gitlab_path - -Thank you. -END - -echo "written $path/description" - -cat > $path/hooks/pre-receive <<END -#!/bin/sh - -cat description - -exit 1 -END - -chmod 755 $path/hooks/pre-receive -echo "written $path/hooks/pre-receive" - -echo "repository $path has been disabled and refers to https://gitlab.apertis.org/$gitlab_path" diff --git a/gitlab-scripts/server-side/ls-not-migrated b/gitlab-scripts/server-side/ls-not-migrated deleted file mode 100755 index c2506b5..0000000 --- a/gitlab-scripts/server-side/ls-not-migrated +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# XXX: hardcoded -defaultgroup="packages" - -find /git/ -maxdepth 2 -a -type d 2> /dev/null | while read repo; do - case $repo in - *.git) - ;; - *) - continue - ;; - esac - project=$(basename "$repo" .git) - group=$(basename $(dirname "$repo")) - if [ "$group" = git ] - then - group="$defaultgroup" - fi - if ! grep -q gitlab.apertis.org "$repo/description"; then - echo "./migrate-repo $repo $group/$project" - else - : - fi -done diff --git a/gitlab-scripts/server-side/ls-not-migrated-internal b/gitlab-scripts/server-side/ls-not-migrated-internal deleted file mode 100755 index 1b13ca8..0000000 --- a/gitlab-scripts/server-side/ls-not-migrated-internal +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# XXX: hardcoded -defaultgroup="packages" - -find /internal/ -maxdepth 2 -a -type d 2> /dev/null | while read repo; do - case $repo in - *.git) - ;; - *) - continue - ;; - esac - project=$(basename "$repo" .git) - group=$(basename $(dirname "$repo")) - if [ "$group" = internal ] - then - group="$defaultgroup" - fi - if ! grep -q gitlab.apertis.org "$repo/description"; then - echo "./migrate-repo $repo $group/$project" - else - : - fi -done diff --git a/gitlab-scripts/server-side/migrate-repo b/gitlab-scripts/server-side/migrate-repo deleted file mode 100755 index a69d5d6..0000000 --- a/gitlab-scripts/server-side/migrate-repo +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/python - -import argparse -import errno -import locale -import logging -import os.path -import sys -import time - -import requests - - -if sys.version_info [0] < 3: - input = raw_input - - -# keep trailing slashes if changed -SALSA_BASE_URL='https://gitlab.apertis.org/' -SALSA_API=SALSA_BASE_URL + "api/v4/" -ALIOTH_BASE_URL='https://apertis-internal:<password>@git.apertis.org/' -ENV_VAR='GITLAB_TOKEN' - - -def parse_args(): - parser = argparse.ArgumentParser(description='migrate a repository to GitLab', - epilog="Your GitLab token should be " - "provided via the {} environment variable. You can create one here: " - "{}profile/personal_access_tokens." - "see https://wiki.debian.org/Salsa/AliothMigration for more information".format(ENV_VAR, SALSA_BASE_URL)) - parser.add_argument('path', - help='path to the local git repository (e.g. /git/collab-maint/magic-wormhole.git') - parser.add_argument('salsa_path', - help='path to the remote Salsa repository (e.g. /debian/magic-wormhole') - default_level = 'WARNING' - parser.add_argument('-v', '--verbose', - dest='loglevel', action='store_const', - const='INFO', default=default_level, - help='enable verbose messages') - parser.add_argument('-d', '--debug', - dest='loglevel', action='store_const', - const='DEBUG', default=default_level, - help='enable debugging messages') - parser.add_argument('--loglevel', - default=default_level, type=str.upper, - help='expliticly set logging level') - parser.add_argument('--syslog', - const='INFO', nargs='?', - default=None, type=str.upper, - help='send logs to syslog') - parser.add_argument('--logfile', default=None, - help='write log to the given file (default: %(default)s)') - return parser.parse_args() - - -def setup_logging(args): - logger = logging.getLogger('') - # disable the base filter, each stream has its own filter - logger.setLevel('DEBUG') - if args.syslog: - sl = logging.handlers.SysLogHandler(address='/dev/log') - sl.setFormatter(logging.Formatter(prog+'[%(process)d]: %(message)s')) - # convert syslog argument to a numeric value - sl.setLevel(args.syslog.upper()) - logger.addHandler(sl) - logger.debug('configured syslog level %s' % args.syslog) - handler = logging.StreamHandler() - handler.setFormatter(logging.Formatter('%(message)s')) - handler.setLevel(args.loglevel.upper()) - logger.addHandler(handler) - if args.logfile: - handler = logging.FileHandler(args.logfile) - handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s')) - logger.addHandler(handler) - - -def migrate_repo(args, salsa_repo_url, salsa_group, salsa_subgroup, salsa_repo_path, alioth_url): - # map group name to namespace id - logging.info("guessing namespace name") - # this is too slow on large groups: https://gitlab.com/gitlab-org/gitlab-ce/issues/42415 - #salsa_namespace=$(curl -s "https://gitlab.apertis.org/api/v4/groups/$salsa_group" | jq '.id') - salsa_namespace = None - headers = {'PRIVATE-TOKEN': os.environ[ENV_VAR]} - groups = requests.get(SALSA_API + 'namespaces?search=' + salsa_group, headers=headers) - groups.raise_for_status() - for group in groups.json(): - if group['path'] == salsa_group: - salsa_namespace = group['id'] - - if salsa_namespace == None: - logging.error("namespace query returned invalid namespace (group/user doesn't exist ?)") - return - - if salsa_subgroup is not None: - subgroups = requests.get('{}groups/{}/subgroups'.format(SALSA_API, group['id'])) - subgroups.raise_for_status() - for x in subgroups.json(): - if x['path'] == salsa_subgroup: - salsa_namespace = x['id'] - break - else: - logging.error("could not find subgroup {}".format(salsa_subgroup)) - return - - logging.info("getting the repository description") - desc_path = os.path.join(args.path, 'description') - desc = open(desc_path, 'r').read().strip() - if desc.startswith('Unnamed repository'): - desc = '' - else: - desc = desc + "\n\n" - - logging.info("importing repository into GitLab namespace %s", salsa_namespace) - payload = {'path': salsa_repo_path, - 'namespace_id': salsa_namespace, - 'description': desc + "Repository imported from %s" % requests.utils.urldefragauth(alioth_url), - 'import_url': alioth_url, - 'visibility': 'internal'} - logging.debug('payload: %s', payload) - result = requests.post(SALSA_API + 'projects', data=payload, headers=headers) - logging.debug('result.content: %s', result.content) - try: - result.raise_for_status() - except requests.exceptions.HTTPError as e: - logging.error('request failed with %s', e) - logging.error('%s', result.content) - else: - logging.info('waiting for repository import in %s', salsa_repo_url) - while True: - time.sleep(3) - result = requests.get(salsa_repo_url, headers=headers) - if not result.history: - break - - -def disable_repo(args, salsa_repo_url): - desc_path = os.path.join(args.path, 'description') - with open(desc_path, 'w') as desc: - desc.write('''This repository was moved to gitlab.apertis.org: - - {0} - -This repository is archived. Please update your remotes to use the -following URL instead: - - git@gitlab.apertis.org:{1}.git - -For example: - - $ git remote set-url origin git@gitlab.apertis.org:{1}.git - -or: - - $ git remote set-url origin https://gitlab.apertis.org/{1}.git -'''.format(salsa_repo_url, args.salsa_path.strip('/'))) - - logging.info("written %s/description", args.path) - - hook_path = os.path.join(args.path, 'hooks', 'pre-receive') - try: - # Unlink first in case we can write to the file but cannot call chmod(2) - # later due to user/group permission disparity - os.unlink(hook_path) - except OSError as e: - if e.errno != errno.ENOENT: - raise - with open(hook_path, 'w') as hook: - hook.write('''#!/bin/sh - -echo "Push refused." -echo - -cat description - -echo -echo "Thank you." - -exit 1 -''') - os.chmod(hook_path, 0o755) - logging.info("written %s", hook_path) - - logging.info("repository %s has been disabled and refers to %s", args.path, salsa_repo_url) - - -def yes_no(prompt, default = None): - ans = input(prompt.encode(sys.stdout.encoding or locale.getpreferredencoding(True))) - while default is None and ans.lower() not in ["y", "n"]: - ans = input(prompt.encode(sys.stdout.encoding or locale.getpreferredencoding(True))) - if default: return default - else: return ans.lower() == 'y' - - -def main(): - args = parse_args() - - if not os.path.exists(args.path): - sys.exit("ERROR: local repository not found: {}".format (args.path)) - - if not os.path.exists(os.path.join(args.path, 'hooks')): - sys.exit("ERROR: {} does not have any hooks sub-directory".format (args.path)) - - if os.path.exists(os.path.join(args.path, 'hooks', 'pre-receive')): - if not yes_no('pre-receive hook in place already, overwrite? [Y/n] ', True): - sys.exit('ERROR: hook exists, aborting') - - setup_logging(args) - - alioth_url=ALIOTH_BASE_URL + args.path.strip('/') + '/' - xs = args.salsa_path.strip('/').split('/') - salsa_group, salsa_subgroup, salsa_repo_path = xs[0], None, xs[1] - if len(xs) == 3: - salsa_group, salsa_subgroup, salsa_repo_path = xs - salsa_repo_url = SALSA_BASE_URL + '/'.join(xs) - - if ENV_VAR in os.environ: - migrate_repo(args, salsa_repo_url, salsa_group, salsa_subgroup, salsa_repo_path, alioth_url) - else: - logging.warning('repository not migrated, please provide token via %s to import', - ENV_VAR) - disable_repo(args, salsa_repo_url) - - -if __name__ == '__main__': - main() diff --git a/gitlab-scripts/server-side/migrated-map b/gitlab-scripts/server-side/migrated-map deleted file mode 100644 index a45bf84..0000000 --- a/gitlab-scripts/server-side/migrated-map +++ /dev/null @@ -1,197 +0,0 @@ -/git/apertis-target-meta https://gitlab.apertis.org/attic/apertis-target-meta -/git/mildenhall-settings https://gitlab.apertis.org/hmi/mildenhall-settings -/git/mildenhall-mutter-plugin https://gitlab.apertis.org/hmi/mildenhall-mutter-plugin -/git/mildenhall https://gitlab.apertis.org/hmi/mildenhall -/git/mildenhall-2 https://gitlab.apertis.org/attic/mildenhall-2 -/git/apertis-hmi-meta https://gitlab.apertis.org/attic/apertis-hmi-meta -/git/beckfoot https://gitlab.apertis.org/appfw/beckfoot -/git/apertis-docker-images https://gitlab.apertis.org/infrastructure/apertis-docker-images -/git/libshoreham https://gitlab.apertis.org/hmi/libshoreham -/git/potshaft https://gitlab.apertis.org/kov/potshaft -/git/appmgr-poc https://gitlab.apertis.org/staging/appmgr-poc -/git/newport https://gitlab.apertis.org/appfw/newport -/git/apertis-jenkins-jobs https://gitlab.apertis.org/infrastructure/apertis-jenkins-jobs -/git/sample-applications/helloworld-webapp https://gitlab.apertis.org/sample-applications/helloworld-webapp -/git/sample-applications/helloworld-app https://gitlab.apertis.org/sample-applications/helloworld-app -/git/sample-applications/helloworld-persistapp https://gitlab.apertis.org/sample-applications/helloworld-persistapp -/git/sample-applications/notification-example https://gitlab.apertis.org/sample-applications/notification-example -/git/sample-applications/helloworld-https-client https://gitlab.apertis.org/sample-applications/helloworld-https-client -/git/sample-applications/hard-keys-example https://gitlab.apertis.org/sample-applications/hard-keys-example -/git/sample-applications/helloworld-newport https://gitlab.apertis.org/sample-applications/helloworld-newport -/git/sample-applications/cpp-library-example https://gitlab.apertis.org/sample-applications/cpp-library-example -/git/sample-applications/helloworld-agentapp https://gitlab.apertis.org/sample-applications/helloworld-agentapp -/git/sample-applications/helloworld-simple-agent https://gitlab.apertis.org/sample-applications/helloworld-simple-agent -/git/sample-applications/helloworld-prefsapp https://gitlab.apertis.org/sample-applications/helloworld-prefsapp -/git/eye https://gitlab.apertis.org/hmi/eye -/git/third-party/libmediaart https://gitlab.apertis.org/third-party/libmediaart -/git/third-party/grilo-plugins https://gitlab.apertis.org/third-party/grilo-plugins -/git/third-party/tcmmd https://gitlab.apertis.org/third-party/tcmmd -/git/third-party/weblate https://gitlab.apertis.org/third-party/weblate -/git/third-party/folks https://gitlab.apertis.org/third-party/folks -/git/mildenhall-statusbar https://gitlab.apertis.org/hmi/mildenhall-statusbar -/git/prestwood https://gitlab.apertis.org/hmi/prestwood -/git/apertis-sdk-meta https://gitlab.apertis.org/attic/apertis-sdk-meta -/git/canterbury https://gitlab.apertis.org/appfw/canterbury -/git/chaiwala-bootflags https://gitlab.apertis.org/apertis/chaiwala-bootflags -/git/liblightwood https://gitlab.apertis.org/hmi/liblightwood -/git/libthornbury https://gitlab.apertis.org/hmi/libthornbury -/git/apertis-tests https://gitlab.apertis.org/infrastructure/apertis-tests -/git/traprain https://gitlab.apertis.org/appfw/traprain -/git/image-utils https://gitlab.apertis.org/attic/image-utils -/git/apertis-designs https://gitlab.apertis.org/docs/apertis-designs -/git/liblightwood-2 https://gitlab.apertis.org/attic/liblightwood-2 -/git/mildenhall-popup-layer https://gitlab.apertis.org/hmi/mildenhall-popup-layer -/git/tiny-image-recipes https://gitlab.apertis.org/infrastructure/tiny-image-recipes -/git/apertis-image-recipes https://gitlab.apertis.org/infrastructure/apertis-image-recipes -/git/apertis-development-meta https://gitlab.apertis.org/attic/apertis-development-meta -/git/frome https://gitlab.apertis.org/appfw/frome -/git/chaiwala-user-session https://gitlab.apertis.org/apertis/chaiwala-user-session -/git/ribchester https://gitlab.apertis.org/appfw/ribchester -/git/tinwell https://gitlab.apertis.org/hmi/tinwell -/git/barkway https://gitlab.apertis.org/appfw/barkway -/git/rhosydd https://gitlab.apertis.org/appfw/rhosydd -/git/shapwick https://gitlab.apertis.org/hmi/shapwick -/git/apertis-customizations https://gitlab.apertis.org/infrastructure/apertis-customizations -/git/apertis-docs https://gitlab.apertis.org/docs/apertis-docs -/git/libclapton https://gitlab.apertis.org/hmi/libclapton -/git/apertis-hmi-development-meta https://gitlab.apertis.org/attic/apertis-hmi-development-meta -/git/libbredon https://gitlab.apertis.org/hmi/libbredon -/git/apertis-workshop https://gitlab.apertis.org/sjoerd/apertis-workshop -/git/mildenhall-launcher https://gitlab.apertis.org/hmi/mildenhall-launcher -/git/webkit-gtk-clutter https://gitlab.apertis.org/hmi/webkit-gtk-clutter -/git/apertis-dev-tools https://gitlab.apertis.org/apertis/apertis-dev-tools -/git/backworth https://gitlab.apertis.org/attic/backworth -/git/apertis-image-customization https://gitlab.apertis.org/attic/apertis-image-customization -/git/libgrassmoor https://gitlab.apertis.org/hmi/libgrassmoor -/git/attic/rhayader https://gitlab.apertis.org/attic/rhayader -/git/attic/chalgrove https://gitlab.apertis.org/attic/chalgrove -/git/attic/corbridge https://gitlab.apertis.org/attic/corbridge -/git/libseaton https://gitlab.apertis.org/hmi/libseaton -/git/apertis-eclipse-plugins https://gitlab.apertis.org/apertis/apertis-eclipse-plugins -/git/frampton https://gitlab.apertis.org/appfw/frampton -/git/packaging/hotdoc-search-extension https://gitlab.apertis.org/packaging/hotdoc-search-extension -/git/packaging/seed-webkit2 https://gitlab.apertis.org/packaging/seed-webkit2 -/git/packaging/d-conf https://gitlab.apertis.org/packaging/d-conf -/git/packaging/gtk+3.0 https://gitlab.apertis.org/packaging/gtk-3.0 -/git/packaging/hotdoc https://gitlab.apertis.org/packaging/hotdoc -/git/packaging/evolution-data-server https://gitlab.apertis.org/packaging/evolution-data-server -/git/packaging/apparmor https://gitlab.apertis.org/packaging/apparmor -/git/packaging/hotdoc-tag-extension https://gitlab.apertis.org/packaging/hotdoc-tag-extension -/git/packaging/linux https://gitlab.apertis.org/packaging/linux -/git/packaging/hotdoc-c-extension https://gitlab.apertis.org/packaging/hotdoc-c-extension -/git/packaging/connman https://gitlab.apertis.org/packaging/connman -/git/packaging/hotdoc-syntax-highlighting-extension https://gitlab.apertis.org/packaging/hotdoc-syntax-highlighting-extension -/git/packaging/systemd https://gitlab.apertis.org/packaging/systemd -/git/packaging/gst-plugins-base1.0 https://gitlab.apertis.org/packaging/gst-plugins-base1.0 -/git/packaging/snort https://gitlab.apertis.org/packaging/snort -/git/packaging/walbottle https://gitlab.apertis.org/packaging/walbottle -/git/packaging/ostree https://gitlab.apertis.org/packaging/ostree -/git/packaging/hotdoc-dbus-extension https://gitlab.apertis.org/packaging/hotdoc-dbus-extension -/git/packaging/tumbler https://gitlab.apertis.org/packaging/tumbler -/git/packaging/dbus https://gitlab.apertis.org/packaging/dbus -/git/packaging/u-boot https://gitlab.apertis.org/packaging/u-boot -/git/packaging/glib2.0 https://gitlab.apertis.org/packaging/glib2.0 -/git/packaging/orc https://gitlab.apertis.org/packaging/orc -/git/packaging/policykit-1 https://gitlab.apertis.org/packaging/policykit-1 -/git/packaging/gstreamer1.0 https://gitlab.apertis.org/packaging/gstreamer1.0 -/git/packaging/bluez https://gitlab.apertis.org/packaging/bluez -/git/packaging/hotdoc-gi-extension https://gitlab.apertis.org/packaging/hotdoc-gi-extension -/git/packaging/hotdoc-devhelp-extension https://gitlab.apertis.org/packaging/hotdoc-devhelp-extension -/git/packaging/appstream-glib https://gitlab.apertis.org/packaging/appstream-glib -/git/packaging/plymouth https://gitlab.apertis.org/packaging/plymouth -/git/packaging/libgdata https://gitlab.apertis.org/packaging/libgdata -/git/packaging/mesa https://gitlab.apertis.org/packaging/mesa -/git/packaging/gst-plugins-good1.0 https://gitlab.apertis.org/packaging/gst-plugins-good1.0 -/git/packaging/hotdoc-license-extension https://gitlab.apertis.org/packaging/hotdoc-license-extension -/git/packaging/tracker https://gitlab.apertis.org/packaging/tracker -/git/packaging/pulseaudio https://gitlab.apertis.org/packaging/pulseaudio -/git/didcot https://gitlab.apertis.org/appfw/didcot -/internal/car-demo https://gitlab.apertis.org/car-demo/car-demo -/internal/webbench https://gitlab.apertis.org/car-demo/webbench -/internal/aivi-image-recipes https://gitlab.apertis.org/attic/aivi-image-recipes -/internal/roller-mx https://gitlab.apertis.org/hmi/roller-mx -/internal/linux https://gitlab.apertis.org/adit-gen3/linux -/internal/chaiwala-btrfs https://gitlab.apertis.org/attic/chaiwala-btrfs -/internal/ecore-download-manager https://gitlab.apertis.org/appfw/ecore-download-manager -/internal/gst-routing-adapter https://gitlab.apertis.org/attic/gst-routing-adapter -/internal/roller_experiments https://gitlab.apertis.org/hmi/roller-experiments -/internal/bos0018/mtc-extra-deps https://gitlab.apertis.org/bos00018/mtc-extra-deps -/internal/bos0018/telepathy-farstream https://gitlab.apertis.org/bos00018/telepathy-farstream -/internal/bos0018/gst-plugins-good https://gitlab.apertis.org/bos00018/gst-plugins-good -/internal/bos0018/mtc-agents https://gitlab.apertis.org/bos00018/mtc-agents -/internal/bos0018/voip-extra-deps https://gitlab.apertis.org/bos00018/voip-extra-deps -/internal/bos0018/farstream https://gitlab.apertis.org/bos00018/farstream -/internal/bos0018/voip-qos-demo https://gitlab.apertis.org/bos00018/voip-qos-demo -/internal/u-boot https://gitlab.apertis.org/adit-gen3/u-boot -/internal/apertis-tests https://gitlab.apertis.org/infrastructure/apertis-internal-tests -/internal/doc-web-hooks -/internal/apertis-infrastructure https://gitlab.apertis.org/infrastructure/apertis-infrastructure -/internal/apertis-image-recipes https://gitlab.apertis.org/infrastructure/apertis-internal-image-recipes -/internal/apertis-jenkins-jobs-internal https://gitlab.apertis.org/infrastructure/apertis-internal-jenkins-jobs -/internal/clutter-gtk-stylable-demo https://gitlab.apertis.org/hmi/clutter-gtk-stylable-demo -/internal/apertis-designs-private https://gitlab.apertis.org/docs/apertis-designs-private -/internal/clutter-i18n-demo https://gitlab.apertis.org/hmi/clutter-i18n-demo -/internal/roller_issues https://gitlab.apertis.org/hmi/roller-issues -/internal/assimp-3.2 https://gitlab.apertis.org/car-demo/assimp-3.2 -/internal/roller-samples https://gitlab.apertis.org/hmi/roller-samples -/internal/adit-gpu-sharing https://gitlab.apertis.org/car-demo/adit-gpu-sharing -/internal/apertis-image-customization https://gitlab.apertis.org/attic/apertis-internal-image-customization -/internal/attic/pre-rebase-apertis-tests https://gitlab.apertis.org/attic/pre-rebase-apertis-tests -/internal/attic/pre-rebase-apertis-image-customization https://gitlab.apertis.org/attic/pre-rebase-apertis-image-customization -/internal/attic/chaiwala-apparmor-tests https://gitlab.apertis.org/attic/chaiwala-apparmor-tests -/internal/attic/chaiwala-rollbackd https://gitlab.apertis.org/attic/chaiwala-rollbackd -/internal/attic/sac-test-templates https://gitlab.apertis.org/attic/sac-test-templates -/internal/roller https://gitlab.apertis.org/hmi/roller -/staging/mildenhall-sdk-default-settings https://gitlab.apertis.org/staging/mildenhall-sdk-default-settings -/staging/upchurch https://gitlab.apertis.org/staging/upchurch -/staging/mildenhall-settings https://gitlab.apertis.org/staging/mildenhall-settings -/staging/westhall https://gitlab.apertis.org/staging/westhall -/staging/thetford https://gitlab.apertis.org/staging/thetford -/staging/mildenhall-mutter-plugin https://gitlab.apertis.org/staging/mildenhall-mutter-plugin -/staging/mildenhall-eclipse-plugins https://gitlab.apertis.org/staging/mildenhall-eclipse-plugins -/staging/mildenhall https://gitlab.apertis.org/staging/mildenhall -/staging/mildenhall-2 https://gitlab.apertis.org/staging/mildenhall-2 -/staging/felmingham https://gitlab.apertis.org/staging/felmingham -/staging/beckfoot https://gitlab.apertis.org/staging/beckfoot -/staging/libshoreham https://gitlab.apertis.org/staging/libshoreham -/staging/chaiwala-btrfs https://gitlab.apertis.org/staging/chaiwala-btrfs -/staging/welbourn https://gitlab.apertis.org/staging/welbourn -/staging/libvinovia https://gitlab.apertis.org/staging/libvinovia -/staging/newport https://gitlab.apertis.org/staging/newport -/staging/mildenhall-appstore https://gitlab.apertis.org/staging/mildenhall-appstore -/staging/eye https://gitlab.apertis.org/staging/eye -/staging/mildenhall-statusbar https://gitlab.apertis.org/staging/mildenhall-statusbar -/staging/prestwood https://gitlab.apertis.org/staging/prestwood -/staging/canterbury https://gitlab.apertis.org/staging/canterbury -/staging/reading https://gitlab.apertis.org/staging/reading -/staging/libwickham https://gitlab.apertis.org/staging/libwickham -/staging/langtoft https://gitlab.apertis.org/staging/langtoft -/staging/curridge https://gitlab.apertis.org/staging/curridge -/staging/liblightwood https://gitlab.apertis.org/staging/liblightwood -/staging/libthornbury https://gitlab.apertis.org/staging/libthornbury -/staging/apertis-tests https://gitlab.apertis.org/staging/apertis-tests -/staging/plymouth-theme-mrs https://gitlab.apertis.org/staging/plymouth-theme-mrs -/staging/liblightwood-2 https://gitlab.apertis.org/staging/liblightwood-2 -/staging/mildenhall-popup-layer https://gitlab.apertis.org/staging/mildenhall-popup-layer -/staging/anavio https://gitlab.apertis.org/staging/anavio -/staging/breamore https://gitlab.apertis.org/staging/breamore -/staging/frome https://gitlab.apertis.org/staging/frome -/staging/ribchester https://gitlab.apertis.org/staging/ribchester -/staging/tinwell https://gitlab.apertis.org/staging/tinwell -/staging/barkway https://gitlab.apertis.org/staging/barkway -/staging/shapwick https://gitlab.apertis.org/staging/shapwick -/staging/apertis-docs https://gitlab.apertis.org/staging/apertis-docs -/staging/libalton https://gitlab.apertis.org/staging/libalton -/staging/libclapton https://gitlab.apertis.org/staging/libclapton -/staging/libbredon https://gitlab.apertis.org/staging/libbredon -/staging/mildenhall-launcher https://gitlab.apertis.org/staging/mildenhall-launcher -/staging/backworth https://gitlab.apertis.org/staging/backworth -/staging/walton https://gitlab.apertis.org/staging/walton -/staging/libgrassmoor https://gitlab.apertis.org/staging/libgrassmoor -/staging/attic/rhayader https://gitlab.apertis.org/staging/rhayader -/staging/attic/chalgrove https://gitlab.apertis.org/staging/chalgrove -/staging/attic/corbridge https://gitlab.apertis.org/staging/corbridge -/staging/libseaton https://gitlab.apertis.org/staging/libseaton -/staging/yorkley https://gitlab.apertis.org/staging/yorkley -/staging/frampton https://gitlab.apertis.org/staging/frampton -/staging/didcot https://gitlab.apertis.org/staging/didcot diff --git a/gitlab-scripts/server-side/move-project b/gitlab-scripts/server-side/move-project deleted file mode 100755 index d8c432e..0000000 --- a/gitlab-scripts/server-side/move-project +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -project="$(echo $1 | sed s,/,%2F,g)" - -# echo https://gitlab.apertis.org/api/v4/groups/$2/project/$project - -curl -v -# -H "PRIVATE-TOKEN: $GITLAB_TOKEN" --request POST https://gitlab.apertis.org/api/v4/groups/$2/projects/$project diff --git a/gitlab-scripts/server-side/print-migrated-map b/gitlab-scripts/server-side/print-migrated-map deleted file mode 100755 index ce4dc5b..0000000 --- a/gitlab-scripts/server-side/print-migrated-map +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# XXX: hardcoded -defaultgroup="packages" - -find_repos() { - -find $1 -maxdepth 2 -a -type d 2> /dev/null | while read repo; do - case $repo in - *.git) - ;; - *) - continue - ;; - esac - project=$(basename "$repo" .git) - group=$(basename $(dirname "$repo")) - if [ "$group" = git ] - then - group="$defaultgroup" - fi - url=$(grep -m1 -o 'https://gitlab[^ ]*' "$repo/description") - echo ${repo%%.git} $url -done -} - -find_repos /git/ -find_repos /internal/ -find_repos /staging/ diff --git a/gitlab-scripts/share-with-collabora b/gitlab-scripts/share-with-collabora deleted file mode 100644 index 51b961c..0000000 --- a/gitlab-scripts/share-with-collabora +++ /dev/null @@ -1 +0,0 @@ -for p in $(cat shared-projects); do request=POST ./gitlab /projects/$p/share -d group_id=26 -d group_access=40; done diff --git a/gitlab-scripts/shared-projects b/gitlab-scripts/shared-projects deleted file mode 100644 index 446692e..0000000 --- a/gitlab-scripts/shared-projects +++ /dev/null @@ -1,86 +0,0 @@ -198 -146 -93 -92 -91 -90 -130 -80 -79 -78 -77 -76 -75 -74 -73 -72 -31 -113 -46 -45 -129 -128 -127 -126 -125 -124 -123 -71 -70 -69 -68 -67 -66 -65 -64 -63 -62 -61 -60 -59 -120 -119 -117 -116 -51 -50 -49 -48 -47 -3 -110 -88 -87 -86 -85 -84 -83 -82 -81 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -109 -108 -107 -106 -105 -104 -103 -102 -101 -100 -99 -98 -97 -96 -95 -94 -- GitLab From 6131143ce24f5b16c8388403e75f964e28b85fe9 Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Wed, 21 Aug 2024 16:16:06 -0300 Subject: [PATCH 5/8] Run gitlab-rulez before branching In order to ensure that both gitlab-rulez and its configuration are working as expected, apply the rules before doing the branching. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- .gitlab-ci/branching.yml | 14 +++++++++++--- .gitlab-ci/defaults.yml | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/branching.yml b/.gitlab-ci/branching.yml index 7e75a6f..7b71559 100644 --- a/.gitlab-ci/branching.yml +++ b/.gitlab-ci/branching.yml @@ -1,12 +1,12 @@ include: - local: .gitlab-ci/defaults.yml -branch-protection-relax: +rulez-check: extends: .custom_globals_default variables: - RULES: gitlab-rulez/rulez-relax.yaml + RULES: gitlab-rulez/rulez.yaml ARGS: --gitlab-server-url ${CI_SERVER_URL} --gitlab-api-token ${GITLAB_TOKEN} - stage: branch-protection-relax + stage: rulez-check needs: - explain-done before_script: @@ -27,6 +27,14 @@ branch-protection-relax: - gitlab-rulez $ARGS "$ACTION" --filter 'hmi/*' $RULES || test "$?" -eq 10 - gitlab-rulez $ARGS "$ACTION" --filter 'sample-applications/*' $RULES || test "$?" -eq 10 +branch-protection-relax: + extends: rulez-check + variables: + RULES: gitlab-rulez/rulez-relax.yaml + stage: branch-protection-relax + needs: + - rulez-check + branch-update-image-recipes: extends: .custom_globals_default script: diff --git a/.gitlab-ci/defaults.yml b/.gitlab-ci/defaults.yml index 92f7c18..411aedf 100644 --- a/.gitlab-ci/defaults.yml +++ b/.gitlab-ci/defaults.yml @@ -16,6 +16,7 @@ stages: - fold - manual-review - cleanup + - rulez-check - branch-protection-relax - branch - branch-update-tests -- GitLab From 88f6abe37d2b2ce994fa11444efd0405731ff89c Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Thu, 29 Aug 2024 15:07:09 -0300 Subject: [PATCH 6/8] Create branch-update-base job To improve readability create a new template job for the branch-update tasks. At the same time set the "needs" property to branch-protection-relax, which can save some time when running the pipeline in "testing" mode. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- .gitlab-ci/branching.yml | 34 ++++++++++++++++++++-------------- .gitlab-ci/defaults.yml | 1 - 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci/branching.yml b/.gitlab-ci/branching.yml index 7b71559..c2a505c 100644 --- a/.gitlab-ci/branching.yml +++ b/.gitlab-ci/branching.yml @@ -35,72 +35,78 @@ branch-protection-relax: needs: - rulez-check -branch-update-image-recipes: +.branch-update-base: extends: .custom_globals_default + stage: branch + needs: + - branch-protection-relax + +branch-update-image-recipes: + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g infrastructure -r apertis-image-recipes branch branch-update-tiny-image-recipes: - extends: .custom_globals_default + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g infrastructure -r tiny-image-recipes branch branch-update-tiny-image-debug-utils: - extends: .custom_globals_default + extends: .branch-update-base script: - echo This repo needs to be moved to Gitlab CI, skipping - echo ./release-scripts/branch-update-repo -g infrastructure -r tiny-image-debug-utils branch branch-update-apertis-test-cases: - extends: .custom_globals_default + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g tests -r apertis-test-cases branch branch-update-lava-recipes: - extends: .custom_globals_default + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g infrastructure -r apertis-lava-recipes branch branch-update-docker-images: - extends: .custom_globals_default + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g infrastructure -r apertis-docker-images branch branch-update-helper-tools: - extends: .custom_globals_default + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g tests -r helper-tools branch branch-update-builds-orchestrator: - extends: .custom_globals_default + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g infrastructure -r builds-orchestrator branch branch-update-toolchain: - extends: .custom_globals_default + extends: .branch-update-base script: - ./release-scripts/branch-update-repo -g infrastructure -r apertis-toolchain branch branch-update-flatpak-runtime: - extends: .custom_globals_default + extends: .branch-update-base allow_failure: true script: - ./release-scripts/branch-update-repo -g infrastructure -r apertis-flatpak-runtime branch branch-update-ci-flatdeb-builder: - extends: .custom_globals_default + extends: .branch-update-base allow_failure: true script: - VERSIONED=0 ./release-scripts/branch-update-repo -g infrastructure -r ci-flatdeb-builder branch branch-update-sample-applications: - extends: .custom_globals_default + extends: .branch-update-base allow_failure: true script: - ./release-scripts/branch-update-repo -g sample-applications branch branch-mass-create-branches: - extends: .custom_globals_default + extends: .branch-update-base before_script: - apt update && apt install -y --no-install-recommends python3-minimal @@ -127,7 +133,7 @@ branch-mass-create-branches: $DRY_RUN branch-update-tests-projects: - extends: .custom_globals_default + extends: .branch-update-base stage: branch-update-tests allow_failure: false script: diff --git a/.gitlab-ci/defaults.yml b/.gitlab-ci/defaults.yml index 411aedf..a3016d3 100644 --- a/.gitlab-ci/defaults.yml +++ b/.gitlab-ci/defaults.yml @@ -49,7 +49,6 @@ before_script: # Note: Needs to be inherited by jobs through extends keyword .custom_globals_default: - stage: branch tags: - lightweight rules: -- GitLab From 641a36a2b72654ecb28645e15389374417518535 Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Thu, 29 Aug 2024 15:34:30 -0300 Subject: [PATCH 7/8] Update gitlab-rulez during branching Following the same approach done for other repos update gitlab-rulez. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- .gitlab-ci/branching.yml | 6 ++++++ release-scripts/branch-update-repo | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.gitlab-ci/branching.yml b/.gitlab-ci/branching.yml index c2a505c..3cb0761 100644 --- a/.gitlab-ci/branching.yml +++ b/.gitlab-ci/branching.yml @@ -57,6 +57,12 @@ branch-update-tiny-image-debug-utils: - echo This repo needs to be moved to Gitlab CI, skipping - echo ./release-scripts/branch-update-repo -g infrastructure -r tiny-image-debug-utils branch +branch-update-infrastructure: + extends: .branch-update-base + allow_failure: true + script: + - VERSIONED=0 ./release-scripts/branch-update-repo -g infrastructure -r apertis-infrastructure branch + branch-update-apertis-test-cases: extends: .branch-update-base script: diff --git a/release-scripts/branch-update-repo b/release-scripts/branch-update-repo index 95b9b0d..16b8a00 100755 --- a/release-scripts/branch-update-repo +++ b/release-scripts/branch-update-repo @@ -67,6 +67,15 @@ update-repo-default(){ $RUN git push origin ${OSNAME}/${NEXT_RELEASE} } +update-repo-infrastructure-infrastructure(){ + if [ -f gitlab-rulez/rulez.yaml ] && ! grep -q ${NEXT_RELEASE} gitlab-rulez/rulez.yaml + then + sed -i "s/current_release_branch: .*/current_release_branch: ${NEXT_RELEASE}/" gitlab-rulez/rulez.yaml + git commit -s -m "Bump to ${NEXT_RELEASE}" gitlab-rulez/rulez.yaml + fi + $RUN git push origin +} + update-repo-ci-flatdeb-builder(){ # Only update if the current release's major version is older than or equal to # the major version of the new release. @@ -118,6 +127,9 @@ update-repo-infrastructure(){ ${OSNAME}-image-recipes) udpate-repo-image-recipes ;; + ${OSNAME}-infrastructure) + update-repo-infrastructure-infrastructure + ;; ci-flatdeb-builder) update-repo-ci-flatdeb-builder ;; -- GitLab From de7cacc1caa66e45d848ba5f594ad5ce94e8bbd0 Mon Sep 17 00:00:00 2001 From: Walter Lozano <walter.lozano@collabora.com> Date: Fri, 30 Aug 2024 12:24:50 -0300 Subject: [PATCH 8/8] Move branch-protection-tighten earlier Removing the protection on the repos can be risky, for this reason re-enable it as soon as possible, right after projects have been updated. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- .gitlab-ci/branching.yml | 2 ++ .gitlab-ci/defaults.yml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci/branching.yml b/.gitlab-ci/branching.yml index 3cb0761..c633d6d 100644 --- a/.gitlab-ci/branching.yml +++ b/.gitlab-ci/branching.yml @@ -171,6 +171,8 @@ branch-create-pipeline-schedule: extends: .custom_globals_manual stage: branch-create-pipeline-schedule allow_failure: false + needs: + - branch-protection-tighten script: - | echo "👷 Manually create a pipeline schedule for $NEXT_RELEASE in the builds-orchestrator project" diff --git a/.gitlab-ci/defaults.yml b/.gitlab-ci/defaults.yml index a3016d3..8f611dd 100644 --- a/.gitlab-ci/defaults.yml +++ b/.gitlab-ci/defaults.yml @@ -20,8 +20,8 @@ stages: - branch-protection-relax - branch - branch-update-tests - - branch-create-pipeline-schedule - branch-protection-tighten + - branch-create-pipeline-schedule - apt-create-repos - obs-repository-copy - obs-prjconf-update -- GitLab