Reputation: 113
I have a script which for some reason is invalid with a bunch of errors generated in gitlab pipeline and ci lint such as:
Syntax is incorrect
(): did not find expected key while parsing a block mapping
bad indentation of a sequence entry
.publish:
image: python:3
script:
- printf "const config = { apiUrl: '${API_URL}', environment:
'${CI_ENVIRONMENT_SLUG}', userpool_client_id: '${USERPOOL_CLIENT_ID}',
cognito_domain: '${COGNITO_DOMAIN}' }" > ${BUILD_DIR}/config.js
It creates an object called config and prints it into config.js file during buildtime.
Upvotes: 1
Views: 1045
Reputation: 5136
You need to format your script as a multiline block. One such option would be to use a literal scalar (|
) to preserve your new lines.
.publish:
image: python:3
script:
- |
printf "const config = {
apiUrl: '${API_URL}',
environment:'${CI_ENVIRONMENT_SLUG}',
userpool_client_id: '${USERPOOL_CLIENT_ID}',
cognito_domain: '${COGNITO_DOMAIN}'
}" > ${BUILD_DIR}/config.js
Upvotes: 1