From d3220a7adef2dc8ca030230a30a4a704188fa5f2 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 4 Mar 2019 16:06:49 +0000 Subject: [PATCH] Add utility playbook for fixing gitea project settings We normally only do project settings when we create the project. Add a playbook we can use to do a manual sync from project-config. Change-Id: I5260f2de697420a01d796acc3128be00705a53ee --- .../roles/gitea-git-repos/defaults/main.yaml | 1 + .../gitea-git-repos/tasks/setup-repo.yaml | 2 +- playbooks/sync-gitea-projects.yaml | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 playbooks/sync-gitea-projects.yaml diff --git a/playbooks/roles/gitea-git-repos/defaults/main.yaml b/playbooks/roles/gitea-git-repos/defaults/main.yaml index 0792a5e595..8b646e2eae 100644 --- a/playbooks/roles/gitea-git-repos/defaults/main.yaml +++ b/playbooks/roles/gitea-git-repos/defaults/main.yaml @@ -1 +1,2 @@ gitea_url: https://localhost:3000 +gitea_always_update: false diff --git a/playbooks/roles/gitea-git-repos/tasks/setup-repo.yaml b/playbooks/roles/gitea-git-repos/tasks/setup-repo.yaml index 967cf964ef..fdeb65dbbb 100644 --- a/playbooks/roles/gitea-git-repos/tasks/setup-repo.yaml +++ b/playbooks/roles/gitea-git-repos/tasks/setup-repo.yaml @@ -23,7 +23,7 @@ private: false register: create_repo_result - name: Adjust repo settings - when: project.project not in gitea_repos + when: gitea_always_update or project.project not in gitea_repos uri: url: "{{ gitea_url }}/{{ org }}/{{ repo }}/settings" validate_certs: false diff --git a/playbooks/sync-gitea-projects.yaml b/playbooks/sync-gitea-projects.yaml new file mode 100644 index 0000000000..bd25a86fb0 --- /dev/null +++ b/playbooks/sync-gitea-projects.yaml @@ -0,0 +1,20 @@ +- hosts: "localhost:!disabled" + name: "sync-gitea-projects: Collect the project-config ref" + strategy: free + connection: local + tasks: + - name: Clone project-config repo + git: + repo: https://git.openstack.org/openstack-infra/project-config + dest: /opt/project-config + force: yes + register: gitinfo + +- hosts: "gitea:!disabled" + name: "Create repos on gitea servers" + strategy: free + max_fail_percentage: 1 + roles: + - role: gitea-git-repos + project_config_ref: "{{ hostvars.localhost.gitinfo.after }}" + gitea_always_update: true