Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skms integration #1295

Merged
merged 121 commits into from
Sep 19, 2023
Merged
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
bfcc49f
SKMS CI integration start
amauch-adobe Apr 21, 2023
61731d9
removed pull request flow
amauch-adobe May 20, 2023
0b40daf
changed branch for testing
amauch-adobe May 24, 2023
de86cf1
filled in the values for stage testing
amauch-adobe May 24, 2023
77aada2
temp stage pass
amauch-adobe May 24, 2023
73c0a53
updated skms call
amauch-adobe May 25, 2023
53cc13a
Updated skms.yaml to pull request event
amauch-adobe May 31, 2023
719a277
cleaned up, formatted, updated condition
amauch-adobe Jul 21, 2023
6518ea6
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
9811dae
Skms integration (#969)
amauch-adobe Jul 21, 2023
7d5b42a
added missing curly brace
amauch-adobe Jul 21, 2023
af1736d
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
3cb103e
Skms integration (#972)
amauch-adobe Jul 21, 2023
ab37785
fixing conflicts
amauch-adobe Jul 21, 2023
f428e53
Fixing JSON Parsing
amauch-adobe Jul 21, 2023
a7ce2f8
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
d4d02cc
Skms integration (#973)
amauch-adobe Jul 21, 2023
51b8d80
fixing missing quotes, cleaned up summary
amauch-adobe Jul 21, 2023
8b3bf6e
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
9c5dca9
Skms integration (#974)
amauch-adobe Jul 21, 2023
5187652
debugging JSON Parsing
amauch-adobe Jul 21, 2023
4ba014a
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Jul 21, 2023
8690d1a
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
06fa12f
Skms integration (#975)
amauch-adobe Jul 21, 2023
01f5a27
debugging echos
amauch-adobe Jul 21, 2023
11c1fb2
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Jul 21, 2023
1a551a1
Skms integration (#976)
amauch-adobe Jul 21, 2023
1c7311d
removing line breaks for JSON Parsing
amauch-adobe Jul 21, 2023
b5e240e
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
94731c2
Skms integration (#977)
amauch-adobe Jul 21, 2023
ed91ea6
testing and debugging
amauch-adobe Jul 21, 2023
c510ec5
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Jul 21, 2023
8a9ce5c
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
19933cd
Skms integration (#978)
amauch-adobe Jul 21, 2023
44860e9
testing new line removal
amauch-adobe Jul 21, 2023
5e4a59e
Skms integration (#980)
amauch-adobe Jul 21, 2023
1bf72d7
gave back spacing
amauch-adobe Jul 21, 2023
9ae1f99
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
283b6f9
Skms integration (#981)
amauch-adobe Jul 21, 2023
5c92119
added comma delimited new lines
amauch-adobe Jul 21, 2023
6461a4f
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Jul 21, 2023
52c57c8
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
0eaa0b5
Skms integration (#982)
amauch-adobe Jul 21, 2023
7361cfb
adding spaces for new lines for JSON parser
amauch-adobe Jul 21, 2023
02d9b2d
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Jul 21, 2023
9aafe68
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Jul 21, 2023
8949800
updated workflow name, branch list, api url
amauch-adobe Jul 21, 2023
50f2f49
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Jul 21, 2023
a2cb0f8
Merge branch 'main' into skms-integration
amauch-adobe Jul 21, 2023
7df197f
Merge branch 'main' into skms-integration
amauch-adobe Jul 25, 2023
17e19b4
Removed boiler plate comments
amauch-adobe Jul 25, 2023
22e3860
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Jul 25, 2023
b62244e
Merge branch 'main' into skms-integration
amauch-adobe Jul 25, 2023
b88218e
switched secrets to production ones
amauch-adobe Jul 25, 2023
c4c0b95
testing int vs string
amauch-adobe Jul 27, 2023
a697d31
Merge branch 'main' into skms-integration
amauch-adobe Jul 27, 2023
59265a6
Merge branch 'main' into skms-integration
amauch-adobe Jul 31, 2023
7da0e9b
moved dependency check
amauch-adobe Jul 31, 2023
ace50d2
moved curl call into a response wrapper
amauch-adobe Aug 1, 2023
6c14924
updated curl call wrapper
amauch-adobe Aug 1, 2023
43335ca
small fix to wrapper again
amauch-adobe Aug 1, 2023
286ae1d
fixing failure for command
amauch-adobe Aug 1, 2023
ded9545
testing curl write out
amauch-adobe Aug 1, 2023
82d8b43
updating response output from curl
amauch-adobe Aug 1, 2023
4994729
more clear error messaging
amauch-adobe Aug 1, 2023
65e48b8
added exit status, fixed typo
amauch-adobe Aug 1, 2023
75d6fde
added quote santization
amauch-adobe Aug 1, 2023
9f2f995
Merge branch 'main' into skms-integration
amauch-adobe Aug 1, 2023
3834d2b
Fixing skms api call and removal of quotes
amauch-adobe Aug 2, 2023
e308223
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Aug 2, 2023
dadf4f1
Merge branch 'skm-release-test' into skms-integration
amauch-adobe Aug 2, 2023
d8d3da7
Merge branch 'main' into skms-integration
amauch-adobe Aug 2, 2023
d44d7e2
parameter expansion pattern removal added
amauch-adobe Aug 2, 2023
9bfc65a
instead of removing we will be escaping quotes
amauch-adobe Aug 2, 2023
bb7d7b3
remove quotes immediately
amauch-adobe Aug 2, 2023
f26de95
returned escaped quotes
amauch-adobe Aug 2, 2023
cf1f851
added echo statements
amauch-adobe Aug 2, 2023
1e5f397
updated url
amauch-adobe Aug 2, 2023
491ad33
added removal of single quote
amauch-adobe Aug 2, 2023
0f4144a
same
amauch-adobe Aug 2, 2023
acebad8
added sanitizeStr()
amauch-adobe Aug 2, 2023
50d85f1
added removal of tabs
amauch-adobe Aug 2, 2023
01735ca
removed echo statements
amauch-adobe Aug 2, 2023
b8b87ae
Merge branch 'main' into skms-integration
amauch-adobe Aug 2, 2023
0d108d6
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Aug 4, 2023
dd158ad
added github action secret for two new variables
amauch-adobe Aug 4, 2023
52d8caa
Merge branch 'main' into skms-integration
amauch-adobe Aug 15, 2023
e339025
added back github.actor parameter
amauch-adobe Aug 17, 2023
9ecd31d
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Aug 17, 2023
c5b1e30
added single quotes around CL params
amauch-adobe Aug 22, 2023
5b57765
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Aug 22, 2023
01f5ec3
removed accidental double single quotes
amauch-adobe Aug 22, 2023
d411ca5
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Aug 22, 2023
41878a3
removed single quotes and escaped double quotes
amauch-adobe Aug 22, 2023
103e794
second attempt
amauch-adobe Aug 22, 2023
df8bcb8
fixing quote escaping
amauch-adobe Aug 22, 2023
9c96222
switching to use jq
amauch-adobe Sep 2, 2023
0ce84e7
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Sep 2, 2023
67822fb
debug statements added for testing
amauch-adobe Sep 2, 2023
ba7731e
added more debug statements
amauch-adobe Sep 2, 2023
f42eb4d
sending in workflow run values
amauch-adobe Sep 2, 2023
706a090
concat release summary
amauch-adobe Sep 2, 2023
5289d7f
updated separator for summary
amauch-adobe Sep 2, 2023
571bb49
added repo variable for change executor
amauch-adobe Sep 5, 2023
866bf3e
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Sep 5, 2023
9d25496
Using Github environment variables
amauch-adobe Sep 8, 2023
23c0c21
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Sep 8, 2023
2b74ed4
created separate step for summary
amauch-adobe Sep 8, 2023
dba2fd2
updated release parameter
amauch-adobe Sep 19, 2023
7677948
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Sep 19, 2023
6830ce9
attempting to fix multiline GitHub Env
amauch-adobe Sep 19, 2023
342749a
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Sep 19, 2023
389330f
renamed delimiter
amauch-adobe Sep 19, 2023
7ac4d86
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Sep 19, 2023
afbe5c8
fixing multi-line string
amauch-adobe Sep 19, 2023
da856e5
Merge branch 'skms-release-test' into skms-integration
amauch-adobe Sep 19, 2023
50e46c2
adding more sanitization
amauch-adobe Sep 19, 2023
6f0895e
Merge branch 'skms-integration' of https://github.com/adobecom/milo i…
amauch-adobe Sep 19, 2023
3ef3fd7
reverted str sanitization
amauch-adobe Sep 19, 2023
16077bc
fixing jq add error
amauch-adobe Sep 19, 2023
0b9f7be
fixing the jq add command
amauch-adobe Sep 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/workflows/skms.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Create CMR in SKMS

on:
pull_request:
types:
- closed
branches:
- skms-release-test

jobs:
create-cmr:
# Only run this workflow on pull requests that have merged and not manually closed by user
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Runs a single command using the runners shell for shell validation
- name: Validate Shell
run: echo Starting CMR Action...

- name: Check Dependencies
run: |
if ! type "jq" >/dev/null; then
echo "jq is required but not installed"
exit 1
fi

if ! type "curl" >/dev/null; then
echo "curl is required but not installed"
exit 1
fi

echo "Dependencies check was successful"

- name: Set Maintenance Time Windows for CMR
run: |
echo "start_time=$(TZ=":America/Los_Angeles" date -d "+20 minutes" '+%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "end_time=$(TZ=":America/Los_Angeles" date -d "+30 minutes" '+%Y-%m-%d %H:%M')" >> $GITHUB_ENV

- name: Set Release Summary for CMR
run: |
function sanitizeStr() {
local str=$1

if [ -z "$str" ]; then
echo "First parameter missing, must be a valid string"
return 1
fi

str="${str//\"/""}"
str="${str//\'/""}"
str="${str//$'\r\n\t'/ }"

echo "$str"
}

release_title=$(sanitizeStr "${{ github.event.pull_request.title }}")
release_details=$(sanitizeStr "${{ github.event.pull_request.body }}")
release=Release_Title--"${release_title}"--Release_Details--"${release_details}"--Pull_Request_Number--"${{ github.event.pull_request.number }}"--Pull_Request_Created_At--"${{ github.event.pull_request.created_at }}"--Pull_Request_Merged_At--"${{ github.event.pull_request.merged_at }}"

echo "release_summary<<RS_EOF" >> $GITHUB_ENV
echo "$release" >> $GITHUB_ENV
echo "RS_EOF" >> $GITHUB_ENV

- name: Create CMR in SKMS
run: |
DEFAULT_SKMS_URL='api.skms.adobe.com'

function skms_request() {
local username=$1
local passkey=$2
local object=$3
local method=$4
local method_params=$5
local url=$6

if [ -z "$username" ]; then
echo "First parameter missing, must be SKMS username"
return 1
fi

if [ -z "$passkey" ]; then
echo "Second parameter missing, must be SKMS passkey"
return 1
fi

if [ -z "$object" ]; then
echo "Third parameter missing, must be an SKMS dao object"
return 1
fi

if [ -z "$method" ]; then
echo "Fourth parameter missing, must be SKMS dao method"
return 1
fi

if [ -z "$method_params" ]; then
method_params='{}'
fi

if [ -z "$url" ]; then
url=$DEFAULT_SKMS_URL
fi

local params="{\"_username\":\"${username}\",\"_passkey\":\"${passkey}\",\"_object\":\"${object}\",\"_method\": \"${method}\"}"
local sani_method_params=$(echo "$method_params" | jq -Rsa .)
echo "$sani_method_params"
params=$(echo "$params\n$sani_method_params" | jq -s add)

local response=$(curl --write-out "%{http_code}" --silent --output response.txt https://${url}/web_api --data-urlencode "_parameters=${params}")

if [ $response != "200" ]; then
echo "CURL call returned HTTP status code: $response"
exit 1
elif grep -q "\"status\":\"error\"" response.txt; then
echo "CMR creation failed with response: "
cat response.txt
exit 1
else
echo "CMR creation was successful"
fi
}

skms_request '${{ secrets.SKMS_USER }}' '${{ secrets.SKMS_PASS }}' CmrDao createCmrFromPreapprovedChangeModel '{"change_executor":"${{ secrets.SKMS_CHANGE_EXECUTOR }}","maintenance_window_end_time":"${{ env.end_time }}","maintenance_window_start_time":"${{ env.start_time }}","preapproved_change_model_id":"${{ secrets.SKMS_CHANGE_MODEL_ID }}","summary":"${{ env.release_summary }}"}'
Loading