Skip to content

Commit

Permalink
change control
Browse files Browse the repository at this point in the history
  • Loading branch information
snraonow committed Jul 12, 2023
1 parent b9ee6ea commit abe9c80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
28 changes: 6 additions & 22 deletions terraform/notifyChangeControl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
STEP_NAME=$1
UPSTREAM_STEP_NAME=$2
DATE=$(date +%Y-%m-%d" "%H:%M:%S)
URL=https://$INSTANCE_NAME.service-now.com/api/sn_devops/devops/orchestration/changeControl/
URL=https://$INSTANCE_NAME.service-now.com/api/sn_devops/devops/orchestration/changeControl

# https://docs.env0.com/docs/custom-flows#exposed-env0-system-environment-variables All environment variables

echo "STEP_NAME : $STEP_NAME , , TOOL_ID : $TOOL_ID "
echo "Package Registration invoked to $URL?toolId=$TOOL_ID "

echo "Change control invoked to $URL?toolId=$TOOL_ID "
PIPELINE_URL=api.env0.com/p/$ENV0_PROJECT_ID/environments/$ENV0_ENVIRONMENT_ID

if [[ -z "$UPSTREAM_STEP_NAME" ]]; then
Expand Down Expand Up @@ -38,23 +39,6 @@ CHANGE_CONTROL="{
}
}"

echo "Artifact Data $ARTIFACT_DATA"

curl -X POST -H "Content-Type: application/json" -u "$USERNAME:$PASSWORD" $URL?toolId=$TOOL_ID -d "$CHANGE_CONTROL"

{
"toolId": pipeline.tool.sys_id,
"callbackURL": "unique call back url",
"orchestrationTaskURL": pipeline.pipeline_url + "/" + stage.name + "/",
"orchestrationTaskName": pipeline.orch_pipeline + "#" + stage.name,
"orchestrationTaskDetails": {
"message": "task message",
"triggerType": "upstream",
"taskExecutionURL": pipeline.pipeline_url + "/" + stage.name + "/#" + pipeline.buildNumber,
"orchestrationTaskURL": pipeline.pipeline_url + "/" + stage.name + "/",
"orchestrationTaskName": pipeline.orch_pipeline + "#" + stage.name,
"branchName": "main",
"upstreamTaskExecutionURL": pipeline.pipeline_url + "/" + previousStage.name + "/#" + pipeline.buildNumber ,
"toolId": pipeline.tool.sys_id,
}
}
echo "Change Control Data $CHANGE_CONTROL"

curl -X POST -H "Content-Type: application/json" -u "$USERNAME:$PASSWORD" $URL?toolId=$TOOL_ID -d "$CHANGE_CONTROL"
4 changes: 2 additions & 2 deletions terraform/notifyPackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ URL=https://$INSTANCE_NAME.service-now.com/api/sn_devops/devops/package/registra
# https://docs.env0.com/docs/custom-flows#exposed-env0-system-environment-variables All environment variables

echo "STEP_NAME : $STEP_NAME , , TOOL_ID : $TOOL_ID "
echo "Package Registration invoked to $URL?orchestrationToolId=$TOOL_ID "
echo "Chanage Control invoked to $URL?orchestrationToolId=$TOOL_ID "

PACKAGE_INFO="{
\"name\": \"$ARTIFACT_NAME\",
Expand All @@ -32,7 +32,7 @@ PACKAGE_INFO="{
]
}"

echo "Artifact Data $ARTIFACT_DATA"
echo "Package Info $PACKAGE_INFO"

curl -X POST -H "Content-Type: application/json" -u "$USERNAME:$PASSWORD" $URL?orchestrationToolId=$TOOL_ID -d "$PACKAGE_INFO"

0 comments on commit abe9c80

Please sign in to comment.