Last active
July 21, 2023 07:58
-
-
Save manstis/32e5f9faabe1d9d04a7d56a7be6f46a4 to your computer and use it in GitHub Desktop.
PoC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "ansible-job", | |
"version": "1.0", | |
"specVersion": "0.8", | |
"name": "Ansible Job", | |
"description": "Launch an Ansible Job within Ansible Automation Platform", | |
"start": "Generating the Ansible Job component", | |
"functions": [ | |
{ | |
"name": "runActionTemplateFetch", | |
"operation": "specs/actions-openapi.json#fetch:template" | |
}, | |
{ | |
"name": "runActionGitHubRepoPush", | |
"operation": "specs/actions-openapi.json#github:repo:push" | |
}, | |
{ | |
"name": "runActionCatalogRegister", | |
"operation": "specs/actions-openapi.json#catalog:register" | |
} | |
], | |
"states": [ | |
{ | |
"name": "Generating the Ansible Job component", | |
"type": "operation", | |
"actionMode": "sequential", | |
"actions": [ | |
{ | |
"name": "Run Template Fetch Action", | |
"functionRef": { | |
"refName": "runActionTemplateFetch", | |
"arguments": { | |
"url": "./skeleton", | |
"targetPath": "argo/ansibleJobs/", | |
"values": { | |
"component_id": "${{ .name }}", | |
"jobTemplate": "${{ .jobTemplate }}", | |
"name": "${{ .name }}", | |
"namespace": "${{ .namespace }}", | |
"connection_secret": "${{ .connection_secret }}" | |
} | |
} | |
}, | |
"actionDataFilter": { | |
"toStateData": ".actionResult" | |
} | |
} | |
], | |
"transition": "Generating the Catalog Info Component" | |
}, | |
{ | |
"name": "Generating the Catalog Info Component", | |
"type": "operation", | |
"actionMode": "sequential", | |
"actions": [ | |
{ | |
"functionRef": { | |
"refName": "runActionTemplateFetch", | |
"arguments": { | |
"url": "../../scaffolder-skeletons/catalog-info-skeleton/", | |
"values": { | |
"githubOrg": "${{ .githubOrg }}", | |
"repoName": "${{ .repoName }}", | |
"owner": "${{ .owner }}", | |
"applicationType": "api", | |
"description": "${{ .description }}" | |
} | |
} | |
}, | |
"actionDataFilter": { | |
"toStateData": ".actionResult" | |
} | |
} | |
], | |
"transition": "Publish to GitHub" | |
}, | |
{ | |
"name": "Publish to GitHub", | |
"type": "operation", | |
"actionMode": "sequential", | |
"actions": [ | |
{ | |
"functionRef": { | |
"refName": "runActionGitHubRepoPush", | |
"arguments": { | |
"repoUrl": "github.com?owner=${{ parameters.githubOrg }}&repo=${{ parameters.repoName }}", | |
"protectDefaultBranch": false, | |
"protectEnforceAdmins": false | |
} | |
}, | |
"actionDataFilter": { | |
"toStateData": ".actionResult" | |
} | |
} | |
], | |
"transition": "Register Catalog entry" | |
}, | |
{ | |
"name": "Register Catalog entry", | |
"type": "operation", | |
"actionMode": "sequential", | |
"actions": [ | |
{ | |
"functionRef": { | |
"refName": "runActionCatalogRegister", | |
"arguments": { | |
"repoContentsUrl": "${{ steps.publish.output.repoContentsUrl }}", | |
"catalogInfoPath": "/catalog-info.yaml" | |
} | |
}, | |
"actionDataFilter": { | |
"toStateData": ".actionResult" | |
} | |
} | |
], | |
"end": true | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see a couple of issues now I've tried a real life example:
How do we pass input parameters and literal values?
https://gist.github.com/manstis/32e5f9faabe1d9d04a7d56a7be6f46a4#file-gistfile1-txt-L35-L45
How do we reference the results from a previous step?
https://gist.github.com/manstis/32e5f9faabe1d9d04a7d56a7be6f46a4#file-gistfile1-txt-L113
This appears to use nested arguments. What can we do?
https://gist.github.com/manstis/32e5f9faabe1d9d04a7d56a7be6f46a4#file-gistfile1-txt-L113