[neon/ubuntu-core/models.add-model-autocommit-script] /: Extract base url

Antoine Gonzalez null at kde.org
Wed Oct 2 13:31:09 BST 2024


Git commit 5230751a88280ce8506ac497d767728965b4b4c1 by Antoine Gonzalez.
Committed on 02/10/2024 at 12:31.
Pushed by daspood into branch 'models.add-model-autocommit-script'.

Extract base url

M  +6    -5    update-models.sh

https://invent.kde.org/neon/ubuntu-core/-/commit/5230751a88280ce8506ac497d767728965b4b4c1

diff --git a/update-models.sh b/update-models.sh
index 3f352a8..b95ae01 100755
--- a/update-models.sh
+++ b/update-models.sh
@@ -3,9 +3,10 @@
 # The goal of this script is to download, unpack and commit the `.model` files generated by the CI.
 # It will find the latest pipeline associated with the current local branch and try to fetch artifacts from it.
 
+BASE_URL="https://invent.kde.org/api/v4/projects/17308"
 SCRIPT_PATH=`readlink -f $0`
 SCRIPT_DIR=`dirname $SCRIPT_PATH`
-DL_DIR=`mktemp -d model_artifactsXXX`
+DL_DIR=`mktemp -t -d model_artifactsXXX`
 REF=`git branch --show-current`
 
 cleanup() {
@@ -20,16 +21,16 @@ failure() {
 
 # Fetch Pipeline ID
 
-pipeline_id=`curl -s -f "https://invent.kde.org/api/v4/projects/17308/pipelines" | jq -e "[.[] | select(.ref == \"$REF\")][0].id"` \
+pipeline_id=`curl -s -f "$BASE_URL/pipelines" | jq -e "[.[] | select(.ref == \"$REF\")][0].id"` \
   || failure "Pipeline not found, make sure you have manually triggered a pipeline for this branch"
-job_url="https://invent.kde.org/api/v4/projects/17308/pipelines/$pipeline_id/jobs?scope[]=success"
+job_url="$BASE_URL/pipelines/$pipeline_id/jobs?scope[]=success"
 echo "Using pipeline #$pipeline_id - job url: $job_url"
 
 # Fetch Job ID
 
 job_id=`curl -s -f "$job_url" | jq -e '.[] | select(.name == "neon_core_models") | .id'` \
   || failure "Job not found, make sure you have manually started the 'neon_core_models' job in the pipeline #$pipeline_id and it succeeded"
-artifacts_url="https://invent.kde.org/api/v4/projects/17308/jobs/$job_id/artifacts"
+artifacts_url="$BASE_URL/jobs/$job_id/artifacts"
 echo "Using job #$job_id - artifacts url: $artifacts_url"
 
 # Fetch Job Artefact, Unpack & Commit
@@ -42,4 +43,4 @@ git add -f "$SCRIPT_DIR"/*.model
 git commit -m "Update models"
 
 cleanup
-echo "Commit done, you may verify it before pushing it"
+echo "Commit done, you may verify it before pushing"


More information about the Neon-commits mailing list