I'm trying to read the the GitHub environment variable inside the request json payload while making the curl request but somewhat these variables are not resolving and it gives an error the values I'm trying to read are KEY_VAULT and ACR_PATH:SNAPSHOT_VERSION inside the flow create container web. I've attached the GitHub workflow sample below.
name: Pull Request
on:
pull_request:
types: [review_requested]
env:
KEY_VAULT: "some vault"
SNAPSHOT_VERSION: ${{ format('{0}-SNAPSHOT', github.event.number) }}
GITHUB_ISSUE_NUMBER: ${{ github.event.number }}
GITHUB_REPO: ${{ github.event.repository.name }}
DEPLOYMENT_NOTIFICATION_URL_TOKEN: ${{ secrets.SOME_TOKEN }}
DEPLOYMENT_URL_TOKEN: 123
ENVIRONMENT: sandbox
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Docker login
#if: steps.pr-label.outputs.result == 'true'
uses: azure/docker-login@v1
with:
login-server: acr-login.com
username: user
password: pwd
- name: Publish Snapshot To ACR
#if: steps.pr-label.outputs.result == 'true'
run: |
echo steps.pr-label.outputs.result
echo Publishing to $ACR_PATH:$SNAPSHOT_VERSION
docker build . -t $ACR_PATH:$SNAPSHOT_VERSION
docker push $ACR_PATH:$SNAPSHOT_VERSION
- name: Create Container Web
#if: steps.pr-label.outputs.result == 'true'
run: |
AUTH_HEADER="Authorization: token $DEPLOYMENT_URL_TOKEN"
CONTAINER_WEB_NAME="CONATINER"
PROJECT_NAME="tirumalesh-automate"
REGION="US"
URL="https://abcd.com/$REGION/$PROJECT_NAME/container-web/$CONTAINER_WEB_NAME"
PAYLOAD='{
"spec": {
"image": "${{env.ACR_PATH}}:${{env.SNAPSHOT_VERSION}}",
"secrets": {
"key_vaults": [
{
"name": "${{env.KEY_VAULT}}",
"secrets": [
{
"name": "mysql-pwd",
"environment_variable": "mysql_pwd"
},
]
}
],
},
}
}'
curl --location --request PUT 'https://abcd/us/projects/tirumalesh-automate/resources/container-web/configuration-service' \
--header "$AUTH_HEADER" \
--header 'Content-Type: application/json' \
--data-raw "$PAYLOAD"