Igor Rodionov
04/12/2023, 5:12 PMhatz
04/12/2023, 6:05 PMoutputs: |
url: "${{ env.URL }}"hatz
04/12/2023, 6:05 PM- issue because that character in yaml is technically for an arrayhatz
04/12/2023, 6:09 PMpaths:
description: 'A multiline yaml string of key/value pairs for each Name and Path to include in the comment'
required: false
default: |
Application: application
Dashboard: /dashboard
And then try to directly use it to the matrix write action like
paths: ${{ inputs.paths }}
It ends up breaking because of the newlines and a similar map issue. I got around this currently by turning my multiline yaml into a singleline yaml with newline characters, passing that into the write, and then turning it back into a multiline yaml on the other side. for example
- name: Process paths for output
shell: bash
run: |
echo "paths=$(echo '${{ inputs.paths }}' | awk '{printf "%s\\n", $0}')" >> $GITHUB_ENV
- uses: cloudposse/github-action-matrix-outputs-write@0.3.1
id: out
with:
matrix-step-name: ${{ github.job }}
matrix-key: ${{ env.APPLICATION_NAME }}
outputs: |
url: "${{ env.URL }}"
paths: '${{ env.paths }}'
And then on the read side doing a echo -e so that the newlines get expanded.
Happy to share more details with you if you'd like! Passing around the multiline yaml stuff gets annoying complicated in github actions I've found so this might be some edge cases šIgor Rodionov
04/12/2023, 9:39 PMIgor Rodionov
04/12/2023, 9:39 PMIgor Rodionov
04/12/2023, 9:39 PMhatz
04/13/2023, 1:09 PMhatz
04/13/2023, 1:11 PM: | instead of the : |- - not sure if the newline at the end breaks anything or not but thought I'd mention it! example:
outputs: |
url: '${{ env.URL }}'
paths: '${{ env.paths }}'Igor Rodionov
04/13/2023, 1:11 PMIgor Rodionov
04/13/2023, 1:12 PMhatz
04/13/2023, 1:16 PMhatz
04/13/2023, 1:17 PMhatz
04/13/2023, 1:18 PMIgor Rodionov
04/14/2023, 8:30 AMIgor Rodionov
04/14/2023, 8:30 AMIgor Rodionov
04/14/2023, 8:31 AMIgor Rodionov
04/14/2023, 8:31 AMIgor Rodionov
04/14/2023, 8:32 AMoutputs: |
url: '${{ env.URL }}'
paths: ${{ toJson(env.paths) }}Igor Rodionov
04/14/2023, 8:32 AMhatz
04/19/2023, 6:17 PMhatz
04/24/2023, 5:31 PMhatz
04/24/2023, 5:40 PMpaths: 'Application:
'
fd_name: 'frontend-asset-manager'
---------------------
YAMLParseError: Missing closing 'quote at line 2, column 21:
paths: 'Application:
^
This seems to be related to the multi-line yaml that I have where the value is an empty string
here is my input
outputs: |
url: ${{ env.URL }}
paths: '${{ inputs.paths }}'
fd_name: ${{ env.FD_NAME }}hatz
04/24/2023, 5:40 PMhatz
04/24/2023, 5:41 PMhatz
04/24/2023, 5:51 PMError: Outputs should be valid YAML
---------------------
url: https://frontend-usdf-382.figureapps.dev
paths: Application:
fd_name: frontend-usdf
---------------------
YAMLParseError: Nested mappings are not allowed in compact mappings at line 2, column 8:
paths: Application:
^hatz
04/24/2023, 6:05 PMoutputs: | and outputs: |- tooIgor Rodionov
04/24/2023, 6:06 PMpaths: '${{ toJson(inputs.paths) }}'Igor Rodionov
04/24/2023, 6:06 PMhatz
04/24/2023, 6:23 PMpaths: '${{ toJson(inputs.paths) }}'
it ends up looking like this:
with:
matrix-step-name: ephemeral-deploy
matrix-key: frontend-auth-382
outputs: url: https://frontend-auth-382.url.com
paths: '"Application:\n"'
fd_name: frontend-auth
However, on the read side I'm still only actually seeing one entry.
No artifact name specified, downloading all artifacts
Creating an extra directory for each artifact that is being downloaded
starting download of artifact 1ad31b158455284757e5320e8e4ca65ed4c909fce6554d4713a764e6480d9f11 : 1/9
Total number of files that will be downloaded: 1
starting download of artifact 1de3311f3a5fb2f26beb247ba1ee2e3866eac7f2cd014ca2b940117f87d46d22 : 2/9
Total number of files that will be downloaded: 1
starting download of artifact 4fc8f69a7cd20390d89bc18ea6400ec381bfea1ff6fe77c64d0b0439ab3de809 : 3/9
Total number of files that will be downloaded: 1
starting download of artifact 4fea876fd1027053d0ddf38e74b805fbe8a4e1944613e2c7aecb501d79f1d512 : 4/9
Total number of files that will be downloaded: 1
starting download of artifact 6c4186c01f171e8d190e6b8688645a0591030d0cced58c86b353d565a0211bda : 5/9
Total number of files that will be downloaded: 1
starting download of artifact 86464d497618037bd50d8e9925b69000e8e433dae9c05a2a99e356fd93147d90 : 6/9
Total number of files that will be downloaded: 1
starting download of artifact a23bd2a5d63a624994e3258b3dc50af5a26bdb6fe7ec483b51a89546f99ba47b : 7/9
Total number of files that will be downloaded: 1
starting download of artifact bf4c9fa23d050fb0912454d8a2a9d6d40f16c348289320fde9e4d9e59f21d635 : 8/9
Total number of files that will be downloaded: 1
starting download of artifact d7a846ded11eb21020889310d301d57d579499d0034000632dd9dfe1f27571c8 : 9/9
Total number of files that will be downloaded: 1
There were 9 artifacts downloaded
Everything gets downloaded. but then the json seems to not be merging them together
json=$(echo '${{ steps.read-matrix.outputs.result }}')
echo $json
{
"url": {
"matrix_key": "https://frontend.url.com"
},
"paths": {
"matrix_key": "\"Application:\\n\""
},
"fd_name": {
"matrix_key": "frontend"
}
}hatz
04/24/2023, 6:27 PMpaths: ${{ toJson(inputs.paths) }}
became
paths: "Application:\n"
but the read was the same issuehatz
04/24/2023, 6:29 PM{
"matrix_key": {
"url": "https://frontend-auth.url.com",
"paths": "Application:\n",
"fd_name": "frontend-auth"
}
}
{
"matrix_key": {
"url": "https://frontend-group.url.com",
"paths": "Application:\n",
"fd_name": "frontend-group"
}
}hatz
04/24/2023, 6:31 PM-write action is now incompatible with the -read action. Here's an example json from 0.3.1 release:
{
"frontend-auth": {
"url": "https://frontend-auth.url.com",
"paths": "Application:\\n\\n",
"fd_name": "frontend-auth"
}
}hatz
04/24/2023, 6:32 PMmatrix_key as a string literal instead of a value refhatz
04/24/2023, 6:42 PMhatz
04/24/2023, 6:45 PM\\n instead of \n, but at least the first issue should be fixed)hatz
04/24/2023, 7:27 PM\\n and I forgot to remove it in my testing, so it's all working well with the above PR fix I made + the toJson() you recommended!hatz
04/26/2023, 2:31 PMhatz
04/26/2023, 5:49 PMhatz
04/26/2023, 5:50 PMwith:
matrix-step-name: ephemeral-deploy
outputs: url: ''
paths: 'Application:\n\n'
fd_name: ''
errors: '\n\n```\n:x: argocd_token is null. Please reach out to #devops so we can help you onboard.\n```'
e.g. if an error happens I'm passing errors through, but that means other fields (like my url) never got created so that becomes ''
Error: Expected '' to not equal ''