Skip to content

Commit

Permalink
fix: 🐛 correctly handle branch protection on catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Jan 13, 2025
1 parent a7c0983 commit 044ec00
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions roles/gitlab-catalog/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
environment:
GIT_SSL_NO_VERIFY: "1"

- name: Remove branch protection
community.general.gitlab_protected_branch:
api_url: https://{{ gitlab_domain }}
api_token: "{{ gitlab_token }}"
project: "{{ dsc.global.projectsRootDir | join('/') }}/catalog"
name: main
state: absent
ignore_errors: true

- name: Sync Git repository with push mirror
ansible.builtin.shell: |
set -e
Expand All @@ -38,3 +47,12 @@
path: catalog
group: "{{ dsc.global.projectsRootDir | join('/') }}"
visibility: internal

- name: Apply branch protection
community.general.gitlab_protected_branch:
api_url: https://{{ gitlab_domain }}
api_token: "{{ gitlab_token }}"
project: "{{ dsc.global.projectsRootDir | join('/') }}/catalog"
name: main
push_access_level: nobody
state: present

0 comments on commit 044ec00

Please sign in to comment.