Skip to content
Snippets Groups Projects
Commit ce11ffb9 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Workaround for using the group access token to trigger the pipeline for each project

parent cb0f2f54
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,17 @@ PROJECT_IDS="41" # Use TS-0019 for debugging ...@@ -14,7 +14,17 @@ PROJECT_IDS="41" # Use TS-0019 for debugging
# Trigger pipeline for each project. Triggered pipeline pages job will handle the upgrade of the index.html # Trigger pipeline for each project. Triggered pipeline pages job will handle the upgrade of the index.html
for PROJECT_ID in $PROJECT_IDS; do for PROJECT_ID in $PROJECT_IDS; do
echo "------ Preparing specification project --------" echo "------ Preparing specification project --------"
curl -X POST --fail -F token=$1 -F ref=main https://git.onem2m.org/api/v4/projects/$PROJECT_ID/trigger/pipeline #WORKAROUND UNTIL ACCESS TOKEN WORKS FOR TRIGGERING A PIPELINE (right now, it is allowed but it seems NOT to work)
#create a pipeline trigger token first
echo "------ Creating pipeline trigger token --------"
PIPELINE_TRIGGER_TOKEN_ID=$(curl --request POST --header "PRIVATE-TOKEN:$1" --form description="Temporary pipeline trigger token for tools/scripts" https://git.onem2m.org/api/v4/projects/$PROJECT_ID/triggers | grep -o '"id":[^,]*,"token"'|cut -d',' -f1 | cut -d':' -f2)
PIPELINE_TRIGGER_TOKEN=$(curl --header "PRIVATE-TOKEN:$1" https://git.onem2m.org/api/v4/projects/$PROJECT_ID/triggers/$PIPELINE_TRIGGER_TOKEN_ID | grep -o '"token":[^,]*'|cut -d'"' -f4)
echo "------ Triggering pipeline --------"
#trigger the pipeline
curl -X POST --fail -F token=$PIPELINE_TRIGGER_TOKEN -F ref=main https://git.onem2m.org/api/v4/projects/$PROJECT_ID/trigger/pipeline
echo "------ Deleting pipeline trigger token (NOTE that information about the token that caused the pipeline will NOT be available for the pipeline) --------"
#remove the pipeline trigger token
curl --request DELETE --header "PRIVATE-TOKEN:$1" "https://git.onem2m.org/api/v4/projects/$PROJECT_ID/triggers/$PIPELINE_TRIGGER_TOKEN_ID"
done done
exit 0 exit 0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment