[gnome-build-meta/abderrahim/update-refs-script] test
- From: Jordan Petridis <jpetridis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/abderrahim/update-refs-script] test
- Date: Wed, 5 Oct 2022 14:27:13 +0000 (UTC)
commit 8ec1a976a60ce1bcad78fa17526be043e8f57057
Author: Jordan Petridis <jordan centricular com>
Date: Tue Oct 4 16:44:26 2022 +0200
test
.gitlab-ci.yml | 46 +++++++++++++++++++++++++++++++-
.gitlab-ci/buildstream-nopush.conf | 4 +++
utils/check-open-mrs.py | 18 +++++++++++++
utils/{update_refs.py => update-refs.py} | 16 -----------
4 files changed, 67 insertions(+), 17 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index db9dc2d7d..9b83fe5c2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,7 +12,7 @@ variables:
# Docker Images
DOCKER_REGISTRY: "registry.gitlab.com/freedesktop-sdk/infrastructure/freedesktop-sdk-docker-images"
- DOCKER_IMAGE_ID: "3bee7d7876bc776cdf8379ab0713fcd405ac5002"
+ DOCKER_IMAGE_ID: "a470cd0ecc1a005e9456b98845455ed1bcdc6b7b"
stages:
- track
@@ -523,6 +523,50 @@ test-pinephone-pro-aarch64:
- aarch64
- gnome-build-meta
+update_refs:
+ stage: 'track'
+ tags:
+ - x86_64
+ - gnome-build-meta
+ # FIXME:
+ # Weird bst tracking the same repo issue
+ retry: 2
+ rules:
+ # FIXME: filter out the rest of the jobs on this pipeline
+ - if: $UPDATE_REFS == "yes" && $CI_PIPELINE_SOURCE == "schedule"
+ - if: $CI_COMMIT_REF_NAME == "abderrahim/update-refs-script"
+ script:
+ # Setup ssh
+ - eval $(ssh-agent -s)
+ - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
+
+ - mkdir -p ~/.ssh
+ - chmod 700 ~/.ssh
+
+ # FIXME: use static knownkeys with a var
+ # https://gitlab.com/gitlab-examples/ssh-private-key/-/blob/master/.gitlab-ci.yml#L38
+ - ssh-keyscan gitlab.gnome.org >> ~/.ssh/known_hosts
+ - chmod 644 ~/.ssh/known_hosts
+
+ - ssh -Tv git gitlab gnome org
+
+ - git config --global user.email "sysadmin gnome org"
+ - git config --global user.name "gnomebot"
+
+ - python3 utils/check-open-mrs.py
+ - python3 utils/update-refs.py
+
+ - git switch --force-create update-bot/$(date "+%F-%H-%M")
+ - git add --update .
+ - git commit --message "Update element refs"
+ - git show
+
+ - git remote set-url --push origin git gitlab gnome org:GNOME/gnome-build-meta.git
+
+ # - git push -o merge_request.create -o merge_request.assign=44433 -o merge_request.remove_source_branch
origin HEAD
+ after_script:
+ - rm ssh.key
+
pages:
stage: 'reports'
diff --git a/.gitlab-ci/buildstream-nopush.conf b/.gitlab-ci/buildstream-nopush.conf
index 06a5c2304..f8f3fafa7 100644
--- a/.gitlab-ci/buildstream-nopush.conf
+++ b/.gitlab-ci/buildstream-nopush.conf
@@ -13,6 +13,10 @@ sourcedir: /cache/buildstream/sources
# Keep building and find all the errors
scheduler:
on-error: continue
+ # only fetch/track a single repo at the time
+ # fixme: weird track of same repo issue
+ fetchers: 1
+ network-retries: 3
# Get a lot of output in case of errors
logging:
diff --git a/utils/check-open-mrs.py b/utils/check-open-mrs.py
new file mode 100644
index 000000000..ca19a279f
--- /dev/null
+++ b/utils/check-open-mrs.py
@@ -0,0 +1,18 @@
+#! /usr/bin/env python3
+
+import requests
+import os
+
+def check_for_existing_mr():
+ headers = {'JOB_TOKEN': os.environ["CI_JOB_TOKEN"] }
+
+ # FIXME:
+ url = f"https://gitlab.gnome.org/api/v4/projects/456/merge_requests?author_username=bertob&state=opened"
+
+ resp = requests.get(url, headers=headers)
+ print(resp.json())
+ resp.raise_for_status()
+
+ if resp.json():
+ print("There's an existing MR already. Exiting!")
+ exit(1)
diff --git a/utils/update_refs.py b/utils/update-refs.py
similarity index 71%
rename from utils/update_refs.py
rename to utils/update-refs.py
index 1e5f02f51..c9c5bc72f 100755
--- a/utils/update_refs.py
+++ b/utils/update-refs.py
@@ -21,23 +21,7 @@ track_elements = [
bst_command = os.environ.get("BST", "bst").split()
-
-def git(*args):
- return subprocess.check_call(["git"] + list(args))
-
-
def bst(*args):
return subprocess.check_call(bst_command + ["--no-interactive"] + list(args))
-
bst("track", "--deps", "all", *track_elements)
-
-git(
- "switch",
- "--force-create",
- "update-bot/" + now.strftime("%F-%H-%M"),
-)
-
-git("add", "--update", ".")
-
-git("commit", "--message", "Update element refs")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]