feat(ci): git gubmodule update trigger moved to api call via curl
this was done so that the environment keyword could be used and then shown in the MR !48 nofusscomputing/projects/ansible/git_configuration!62
This commit is contained in:
@ -109,24 +109,38 @@ include:
|
||||
|
||||
.submodule_update_trigger:
|
||||
stage: publish
|
||||
trigger:
|
||||
project: $SUBMODULE_UPDATE_TRIGGER_PROJECT
|
||||
branch: development
|
||||
forward:
|
||||
yaml_variables: false
|
||||
# trigger:
|
||||
# project: $SUBMODULE_UPDATE_TRIGGER_PROJECT
|
||||
# branch: development
|
||||
# inherit:
|
||||
# variables: false
|
||||
script:
|
||||
# use script to trigger pipeline instead of trigger keyword.
|
||||
# this is due to trigger keyword not allowing environment keyword.
|
||||
- export TRIGGER_PROJECT_PATH=$(python3 -c "import urllib.parse, sys; print('$SUBMODULE_UPDATE_TRIGGER_PROJECT'.replace('/', '%2F'))")
|
||||
- echo "[DEBUG] TRIGGER_PROJECT_PATH=$TRIGGER_PROJECT_PATH"
|
||||
- |
|
||||
curl \
|
||||
--request POST \
|
||||
--form "token=$CI_JOB_TOKEN" \
|
||||
--form ref=development \
|
||||
--form "variables[GIT_CONFIG_SUBMODULE_NAME]=$GIT_CONFIG_SUBMODULE_NAME" \
|
||||
--form "variables[PIPELINE_RUN_TRIGGER]=$PIPELINE_RUN_TRIGGER" \
|
||||
"https://gitlab.com/api/v4/projects/$TRIGGER_PROJECT_PATH/trigger/pipeline"
|
||||
environment:
|
||||
name: $SUBMODULE_UPDATE_TRIGGER_PROJECT
|
||||
url: https://gitlab.com/$SUBMODULE_UPDATE_TRIGGER_PROJECT
|
||||
variables:
|
||||
PIPELINE_RUN_TRIGGER: 'true'
|
||||
GIT_CONFIG_SUBMODULE_NAME: $CI_PROJECT_NAME
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
|
||||
- if: # condition_master_or_dev_push
|
||||
(
|
||||
$CI_COMMIT_BRANCH == "master" ||
|
||||
$CI_COMMIT_BRANCH == "development"
|
||||
)&&
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
) &&
|
||||
$CI_PIPELINE_SOURCE == "push" &&
|
||||
$CI_COMMIT_TAG == null
|
||||
when: on_success
|
||||
|
||||
- when: never
|
||||
- when: never
|
||||
|
Reference in New Issue
Block a user