%PDF-
%PDF-
Mini Shell
Mini Shell
name: "Validate PR and Trigger Release"
on:
pull_request:
types: [opened, edited, reopened, synchronize, closed]
env:
DEV_SSO_URL: 'https://sso.dev-godaddy.com/v1/secure/api/token'
TEST_SSO_URL: 'https://sso.test-godaddy.com/v1/secure/api/token'
PROD_SSO_URL: 'https://sso.godaddy.com/v1/secure/api/token'
DEV_GDCORE_API_URL: 'https://gdcore.api.int.dev-gdcorp.tools/v1/plugins/pws-core'
TEST_GDCORE_API_URL: 'https://gdcore.api.int.test-gdcorp.tools/v1/plugins/pws-core'
PROD_GDCORE_API_URL: 'https://gdcore.api.int.gdcorp.tools/v1/plugins/pws-core'
DEV_V3_API_LOGIN_URL: 'https://core.pws.dev-godaddy.com/api/coreUsers/login'
DEV_V3_API_PLUGINS_URL: 'https://core.pws.dev-godaddy.com/api/plugins'
TEST_V3_API_LOGIN_URL: 'https://core.pws.test-godaddy.com/api/coreUsers/login'
TEST_V3_API_PLUGINS_URL: 'https://core.pws.test-godaddy.com/api/plugins'
PROD_V3_API_LOGIN_URL: 'https://core.pws.godaddy.com/api/coreUsers/login'
PROD_V3_API_PLUGINS_URL: 'https://core.pws.godaddy.com/api/plugins'
V3_API_UPLOAD_PLUGIN_ZIP_PATH: "/ceph/uploadPlugin/"
V3_API_ACCESS_TOKEN_QUERY: "?access_token="
name: "GD cORe"
alias: "PWS cORe"
slug: "pws-core"
accessLevel: 2
effort: "V3"
hosted: true
required: true
jobs:
Validate_PR_Title_and_Run_Tartufo_scan:
runs-on:
- self-hosted
- 7219-mscicdrunners
outputs:
RELEASE_VERSION: ${{ steps.set-release-version.outputs.RELEASE_VERSION }}
steps:
- name: validate PR Title
id: set-release-version
run: |
pr_title=$(echo "${{ github.event.pull_request.title }}")
regex='^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$'
if ! [[ "$pr_title" =~ $regex ]]; then
echo "Invalid PR Title Format. Version Number missing: $pr_title"
exit 1
fi
echo "Valid Title: $pr_title"
echo "RELEASE_VERSION=$pr_title" >> "$GITHUB_OUTPUT"
- name: Checkout Current Repo to be Scanned
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0;
- name: Tartufo Scan
uses: godaddy/tartufo-action@v3.2.1
with:
branch: ${{ github.ref.name }}
Add_Tag_To_Git:
runs-on:
- self-hosted
- 7219-mscicdrunners
needs: [Validate_PR_Title_and_Run_Tartufo_scan]
if: >
github.event_name == 'pull_request' &&
github.event.action == 'closed' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.base.ref, 'master')
steps:
- name: Checkout Current Repo
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0;
- name: Add git config
run: |
git config user.email "$(jq -r '.pull_request.user.email' $GITHUB_EVENT_PATH)"
git config user.name "$(jq -r '.pull_request.user.login' $GITHUB_EVENT_PATH)"
- name: Add Git Tag
run: |
git tag ${{ needs.Validate_PR_Title_and_Run_Tartufo_scan.outputs.RELEASE_VERSION }}
git push origin --tags
- name: Reset git config
run: |
git config --unset-all user.email
git config --unset-all user.name
Upload_Release_To_V3_API_DEV:
runs-on:
- self-hosted
- 7219-mscicdrunners
needs: [Validate_PR_Title_and_Run_Tartufo_scan, Add_Tag_To_Git]
steps:
- name: Checkout Current Repo to be Scanned
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0;
- name: Get AWS Secrets
with:
output_aws_session: "true"
environment: dev
id: mystiko
uses: gdcorp-actions/mystiko@40a56358bd43d71c206a02d5fbf802a05995f34d
- name: Get Token
id: get-token
run: |
PAYLOAD="{\"username\":\"${{ steps.mystiko.outputs.V3_API_Username }}\", \"password\":\"${{ steps.mystiko.outputs.V3_API_Password }}\"}"
TOKEN=$( curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d "$PAYLOAD" "$DEV_V3_API_LOGIN_URL" | jq -r '.id')
echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
- name: Get PWS-Core PlugIn Id
id: get-pws-core-id
run: |
URL="${DEV_V3_API_PLUGINS_URL}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
ALL_PLUGINS=$( curl -X GET --header 'Accept: application/json' "$URL" )
PWS_CORE=$(echo "$ALL_PLUGINS" | jq '.[] | select(.name == "GD cORe")')
PWS_CORE_ID=$(echo "$PWS_CORE" | jq -r '.id')
echo "PWS_CORE_ID=$PWS_CORE_ID" >> "$GITHUB_OUTPUT"
- name: Update Latest Release info of GD Core
run: |
PAYLOAD="{ \"name\": \"${name}\", \"alias\": \"${alias}\", \"slug\": \"${slug}\", \"accessLevel\": ${accessLevel}, \"blacklist\": \"\", \"version\": \"${{ needs.Validate_PR_Title_and_Run_Tartufo_scan.outputs.RELEASE_VERSION }}\", \"effort\": \"${effort}\", \"hosted\": ${hosted}, \"required\": ${required}, \"versionURL\": \"\", \"versionSelector\": \"\", \"id\":\"${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}\" }"
URL="${DEV_V3_API_PLUGINS_URL}/${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d "$PAYLOAD" "$URL"
- name: Create Zip
working-directory: ..
run: |
rm -f "${slug}.zip"
zip -r "${slug}.zip" "${slug}"
- name: Upload Zip
working-directory: ..
run: |
PAYLOAD="{\"fileName\":\"${slug}.zip\"}"
URL="${DEV_V3_API_PLUGINS_URL}${V3_API_UPLOAD_PLUGIN_ZIP_PATH}${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
UPLOAD_RESPONSE=$(curl -s -o /dev/null -w "\n%{http_code}\n" POST -H "body:$PAYLOAD" -H 'Content-Type: application/zip' --data-binary "@-" < "${slug}.zip" "$URL")
echo "$UPLOAD_RESPONSE"
RESPONSE_CODE=$(echo "$UPLOAD_RESPONSE" | tail -n 1)
if [ $RESPONSE_CODE -ne 200 ]; then
echo "API call to upload failed with response $RESPONSE_CODE"
exit 1
fi
- name: Remove zip from server
working-directory: ..
run: |
rm -f pws-core.zip
Upload_Release_To_GDCORE_API_DEV:
runs-on:
- self-hosted
- 7219-mscicdrunners
needs: [Validate_PR_Title_and_Run_Tartufo_scan, Add_Tag_To_Git]
steps:
- name: Checkout Current Repo to be Scanned
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0;
- name: Get AWS Secrets
with:
output_aws_session: "true"
environment: dev
id: mystiko
uses: gdcorp-actions/mystiko@40a56358bd43d71c206a02d5fbf802a05995f34d
- name: Get Cert Jwt
id: get-cert-jwt
run: |
echo "${{ steps.mystiko.outputs.AUTH_CLIENT_CERT }}" > client.crt
echo "${{ steps.mystiko.outputs.AUTH_CLIENT_KEY }}" > client.key
RESPONSE=$(curl --cert client.crt --key client.key -X POST --form 'realm="cert"' "$DEV_SSO_URL")
JWT=$(echo "$RESPONSE" | jq -r '.data')
echo "JWT=$JWT" >> "$GITHUB_OUTPUT"
rm client.crt client.key
- name: Create Zip
working-directory: ..
run: |
rm -f "${slug}.zip"
zip -r "${slug}.zip" "${slug}"
- name: Update pws-core plugin in GD Core API
working-directory: ..
run: |
UPLOAD_RESPONSE=$(curl -s -w "\n%{http_code}\n" --location --request PUT "$DEV_GDCORE_API_URL" \
--header 'X-APP-KEY: pws-core-gha' \
--header "Authorization: sso-jwt ${{ steps.get-cert-jwt.outputs.JWT }}" \
--form "file=@${slug}.zip" \
--form "name=${name}" \
--form "version=${{ needs.Validate_PR_Title_and_Run_Tartufo_scan.outputs.RELEASE_VERSION }}" \
--form "hosted=${hosted}" \
--form "effort=${effort}")
echo "$UPLOAD_RESPONSE"
RESPONSE_CODE=$(echo "$UPLOAD_RESPONSE" | tail -n 1)
if [ $RESPONSE_CODE -ne 200 ]; then
echo "API call to GD Core API failed with response code $RESPONSE_CODE"
exit 1
fi
- name: Remove zip from server
working-directory: ..
run: |
rm -f pws-core.zip
Upload_Release_To_V3_API_TEST:
runs-on:
- self-hosted
- 7219-mscicdrunners
needs: [Validate_PR_Title_and_Run_Tartufo_scan, Add_Tag_To_Git, Upload_Release_To_V3_API_DEV]
if: >
github.event_name == 'pull_request' &&
github.event.action == 'closed' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.base.ref, 'master')
steps:
- name: Checkout Current Repo to be Scanned
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0;
- name: Get AWS Secrets
with:
output_aws_session: "true"
environment: test
id: mystiko
uses: gdcorp-actions/mystiko@40a56358bd43d71c206a02d5fbf802a05995f34d
- name: Get Token
id: get-token
run: |
PAYLOAD="{\"username\":\"${{ steps.mystiko.outputs.V3_API_Username }}\", \"password\":\"${{ steps.mystiko.outputs.V3_API_Password }}\"}"
TOKEN=$( curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d "$PAYLOAD" "$TEST_V3_API_LOGIN_URL" | jq -r '.id')
echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
- name: Get PWS-Core PlugIn Id
id: get-pws-core-id
run: |
URL="${TEST_V3_API_PLUGINS_URL}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
ALL_PLUGINS=$( curl -X GET --header 'Accept: application/json' "$URL" )
PWS_CORE=$(echo "$ALL_PLUGINS" | jq '.[] | select(.name == "GD cORe")')
PWS_CORE_ID=$(echo "$PWS_CORE" | jq -r '.id')
echo "PWS_CORE_ID=$PWS_CORE_ID" >> "$GITHUB_OUTPUT"
- name: Update Latest Release info of GD Core
run: |
PAYLOAD="{ \"name\": \"${name}\", \"alias\": \"${alias}\", \"slug\": \"${slug}\", \"accessLevel\": ${accessLevel}, \"blacklist\": \"\", \"version\": \"${{ needs.Validate_PR_Title_and_Run_Tartufo_scan.outputs.RELEASE_VERSION }}\", \"effort\": \"${effort}\", \"hosted\": ${hosted}, \"required\": ${required}, \"versionURL\": \"\", \"versionSelector\": \"\", \"id\":\"${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}\" }"
URL="${TEST_V3_API_PLUGINS_URL}/${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d "$PAYLOAD" "$URL"
- name: Create Zip
working-directory: ..
run: |
rm -f "${slug}.zip"
zip -r "${slug}.zip" "${slug}"
- name: Upload Zip
working-directory: ..
run: |
PAYLOAD="{\"fileName\":\"${slug}.zip\"}"
URL="${TEST_V3_API_PLUGINS_URL}${V3_API_UPLOAD_PLUGIN_ZIP_PATH}${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
UPLOAD_RESPONSE=$(curl -s -o /dev/null -w "\n%{http_code}\n" POST -H "body:$PAYLOAD" -H 'Content-Type: application/zip' --data-binary "@-" < "${slug}.zip" "$URL")
echo "$UPLOAD_RESPONSE"
RESPONSE_CODE=$(echo "$UPLOAD_RESPONSE" | tail -n 1)
if [ $RESPONSE_CODE -ne 200 ]; then
echo "API call to upload failed with response $RESPONSE_CODE"
exit 1
fi
- name: Remove zip from server
working-directory: ..
run: |
rm -f pws-core.zip
Upload_Release_To_GDCORE_API_TEST:
runs-on:
- self-hosted
- 7219-mscicdrunners
needs: [Validate_PR_Title_and_Run_Tartufo_scan, Add_Tag_To_Git, Upload_Release_To_GDCORE_API_DEV]
steps:
- name: Checkout Current Repo to be Scanned
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0;
- name: Get AWS Secrets
with:
output_aws_session: "true"
environment: test
id: mystiko
uses: gdcorp-actions/mystiko@40a56358bd43d71c206a02d5fbf802a05995f34d
- name: Get Cert Jwt
id: get-cert-jwt
run: |
echo "${{ steps.mystiko.outputs.AUTH_CLIENT_CERT }}" > client.crt
echo "${{ steps.mystiko.outputs.AUTH_CLIENT_KEY }}" > client.key
RESPONSE=$(curl --cert client.crt --key client.key -X POST --form 'realm="cert"' "$TEST_SSO_URL")
JWT=$(echo "$RESPONSE" | jq -r '.data')
echo "JWT=$JWT" >> "$GITHUB_OUTPUT"
rm client.crt client.key
- name: Create Zip
working-directory: ..
run: |
rm -f "${slug}.zip"
zip -r "${slug}.zip" "${slug}"
- name: Update pws-core plugin in GD Core API
working-directory: ..
run: |
UPLOAD_RESPONSE=$(curl -s -w "\n%{http_code}\n" --location --request PUT "$TEST_GDCORE_API_URL" \
--header 'X-APP-KEY: pws-core-gha' \
--header "Authorization: sso-jwt ${{ steps.get-cert-jwt.outputs.JWT }}" \
--form "file=@${slug}.zip" \
--form "name=${name}" \
--form "version=${{ needs.Validate_PR_Title_and_Run_Tartufo_scan.outputs.RELEASE_VERSION }}" \
--form "hosted=${hosted}" \
--form "effort=${effort}")
echo "$UPLOAD_RESPONSE"
RESPONSE_CODE=$(echo "$UPLOAD_RESPONSE" | tail -n 1)
if [ $RESPONSE_CODE -ne 200 ]; then
echo "API call to GD Core API failed with response code $RESPONSE_CODE"
exit 1
fi
- name: Remove zip from server
working-directory: ..
run: |
rm -f pws-core.zip
Deploy_To_Prod:
runs-on:
- self-hosted
- 7219-mscicdrunners
needs: [Validate_PR_Title_and_Run_Tartufo_scan, Add_Tag_To_Git, Upload_Release_To_V3_API_DEV, Upload_Release_To_V3_API_TEST]
if: >
github.event_name == 'pull_request' &&
github.event.action == 'closed' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.base.ref, 'master')
environment:
name: prod
steps:
- name: Checkout Current Repo
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0;
- name: Get AWS Secrets
with:
output_aws_session: "true"
environment: prod
id: mystiko
uses: gdcorp-actions/mystiko@40a56358bd43d71c206a02d5fbf802a05995f34d
- name: Get Token
id: get-token
run: |
PAYLOAD="{\"username\":\"${{ steps.mystiko.outputs.V3_API_Username }}\", \"password\":\"${{ steps.mystiko.outputs.V3_API_Password }}\"}"
TOKEN=$( curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d "$PAYLOAD" "$PROD_V3_API_LOGIN_URL" | jq -r '.id')
echo "TOKEN=$TOKEN" >> "$GITHUB_OUTPUT"
- name: Get PWS-Core PlugIn Id
id: get-pws-core-id
run: |
URL="${PROD_V3_API_PLUGINS_URL}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
ALL_PLUGINS=$( curl -X GET --header 'Accept: application/json' "$URL" )
PWS_CORE=$(echo "$ALL_PLUGINS" | jq '.[] | select(.name == "GD cORe")')
PWS_CORE_ID=$(echo "$PWS_CORE" | jq -r '.id')
echo "PWS_CORE_ID=$PWS_CORE_ID" >> "$GITHUB_OUTPUT"
- name: Update Latest Release info of GD Core
run: |
PAYLOAD="{ \"name\": \"${name}\", \"alias\": \"${alias}\", \"slug\": \"${slug}\", \"accessLevel\": ${accessLevel}, \"blacklist\": \"\", \"version\": \"${{ needs.Validate_PR_Title_and_Run_Tartufo_scan.outputs.RELEASE_VERSION }}\", \"effort\": \"${effort}\", \"hosted\": ${hosted}, \"required\": ${required}, \"versionURL\": \"\", \"versionSelector\": \"\", \"id\":\"${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}\" }"
URL="${PROD_V3_API_PLUGINS_URL}/${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d "$PAYLOAD" "$URL"
- name: Create Zip
working-directory: ..
run: |
rm -f "${slug}.zip"
zip -r "${slug}.zip" "${slug}"
- name: Upload Zip
working-directory: ..
run: |
PAYLOAD="{\"fileName\":\"${slug}.zip\"}"
URL="${PROD_V3_API_PLUGINS_URL}${V3_API_UPLOAD_PLUGIN_ZIP_PATH}${{ steps.get-pws-core-id.outputs.PWS_CORE_ID }}${V3_API_ACCESS_TOKEN_QUERY}${{ steps.get-token.outputs.TOKEN }}"
UPLOAD_RESPONSE=$(curl -s -o /dev/null -w "\n%{http_code}\n" POST -H "body:$PAYLOAD" -H 'Content-Type: application/zip' --data-binary "@-" < "${slug}.zip" "$URL")
echo "$UPLOAD_RESPONSE"
RESPONSE_CODE=$(echo "$UPLOAD_RESPONSE" | tail -n 1)
if [ $RESPONSE_CODE -ne 200 ]; then
echo "API call to upload failed with response $RESPONSE_CODE"
exit 1
fi
- name: Remove zip from server
working-directory: ..
run: |
rm -f pws-core.zip
Upload_Release_To_GDCORE_API_PROD:
runs-on:
- self-hosted
- 7219-mscicdrunners
needs: [Validate_PR_Title_and_Run_Tartufo_scan, Add_Tag_To_Git, Upload_Release_To_GDCORE_API_DEV, Upload_Release_To_GDCORE_API_TEST]
environment:
name: prod
steps:
- name: Checkout Current Repo
uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0;
- name: Get AWS Secrets
with:
output_aws_session: "true"
environment: prod
id: mystiko
uses: gdcorp-actions/mystiko@40a56358bd43d71c206a02d5fbf802a05995f34d
- name: Get Cert Jwt
id: get-cert-jwt
run: |
echo "${{ steps.mystiko.outputs.AUTH_CLIENT_CERT }}" > client.crt
echo "${{ steps.mystiko.outputs.AUTH_CLIENT_KEY }}" > client.key
RESPONSE=$(curl --cert client.crt --key client.key -X POST --form 'realm="cert"' "$PROD_SSO_URL")
JWT=$(echo "$RESPONSE" | jq -r '.data')
echo "JWT=$JWT" >> "$GITHUB_OUTPUT"
rm client.crt client.key
- name: Create Zip
working-directory: ..
run: |
rm -f "${slug}.zip"
zip -r "${slug}.zip" "${slug}"
- name: Update pws-core plugin in GD Core API
working-directory: ..
run: |
UPLOAD_RESPONSE=$(curl -s -w "\n%{http_code}\n" --location --request PUT "$PROD_GDCORE_API_URL" \
--header 'X-APP-KEY: pws-core-gha' \
--header "Authorization: sso-jwt ${{ steps.get-cert-jwt.outputs.JWT }}" \
--form "file=@${slug}.zip" \
--form "name=${name}" \
--form "version=${{ needs.Validate_PR_Title_and_Run_Tartufo_scan.outputs.RELEASE_VERSION }}" \
--form "hosted=${hosted}" \
--form "effort=${effort}")
echo "$UPLOAD_RESPONSE"
RESPONSE_CODE=$(echo "$UPLOAD_RESPONSE" | tail -n 1)
if [ $RESPONSE_CODE -ne 200 ]; then
echo "API call to GD Core API failed with response code $RESPONSE_CODE"
exit 1
fi
- name: Remove zip from server
working-directory: ..
run: |
rm -f pws-core.zip
Zerion Mini Shell 1.0
pwsadmin, Author at GMH Consulting Group LLC
Skip to content
Helping Moderna with the SAP S4 supply chain digital transformation of their mRNA Vaccine technology worldwide. #sap #technology #digitaltransformation #s4hana #supplychain Digitalization of Vaccines
Read More
Helping Moderna deliver on the promise of mRNA science to create an new generation of transformative medicines for patients enabled by S/4 Digital Supply Chain. #saps4hana #supplychain #digital #science
Read More
Browse Projects Accomplished by Our Consulting Team
Read More
Scroll To Top