1

I have a script which for some reason is invalid with a bunch of errors generated in gitlab pipeline and ci lint such as:

  1. Syntax is incorrect

  2. (): did not find expected key while parsing a block mapping

  3. 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.

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.