Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
fix: adding correct intention data
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Gomes da Cruz Junior committed Jan 31, 2023
1 parent 21fc29d commit 6211f4d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/intention.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"event": {
"provider": "placeholderprovider",
"reason": "Job triggered",
"url": "JOB_URL"
},
"actions": [
{
"action": "package-provision",
"id": "provision",
"provision": ["approle/secret-id"],
"service": {
"name": "placeholdername",
"project": "placeholderclient",
"environment": "placeholderenv"
}
}
],
"user": {
"id": "placeholderuser"
}
}
17 changes: 15 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ inputs:
provision_role_id:
description: The id of the role to be used during provisioning
required: true
project_name:
description: Name of the project on vault, Ex. client
required: true
app_name:
description: Name of the app on vault, Ex. app-client
required: true
environment:
description: Name of the vault environment, Ex. development
required: true

### Usually a bad idea / not recommended
diff_branch:
Expand Down Expand Up @@ -46,9 +55,13 @@ runs:
shell: bash
run: |
# Read the intention file and replace the event url and the user id
PAYLOAD=$(cat .github/openshift/intention.json | \
PAYLOAD=$(cat .github/intention.json | \
jq ".event.url=\"${GITHUB_SERVER_URL}${GITHUB_ACTION_PATH}\" | \
.user.id=\"${GITHUB_ACTOR}\"")
.user.id=\"${GITHUB_ACTOR}\" | \
.event.provider=\"${{ github.repository }}-github-action\" | \
.actions[0].service.name=\"${{ inputs.app_name }}\" | \
.actions[0].service.project=\"${{ inputs.project_name }}\" | \
.actions[0].service.environment=\"${{ inputs.environment }}\"")
# Open an intention to the broker
INTENTION=$(curl -s -X POST ${{ inputs.broker_url }}/v1/intention/open \
Expand Down

0 comments on commit 6211f4d

Please sign in to comment.