Skip to content

Unable to write multi-line command #61

Description

@nathnet

I was trying to write a command to pull docker image onto a single instance and run the container, but it would always failed. I tried both | and < for starting the multi-line and also both with and without \ at the end of the line as well. None of it works.

      - name: Deploy to sandbox
        uses: oracle-actions/run-oci-cli-command@v1.3.2
        if: ${{ vars.SANDBOX_IN_USE == 'false' }}
        env:
          OCI_CLI_USER: ${{ secrets.OCI_USER_OCID }}
          OCI_CLI_TENANCY: ${{ secrets.OCI_TENANCY_OCID }}
          OCI_CLI_FINGERPRINT: ${{ secrets.OCI_FINGERPRINT }}
          OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_KEY_CONTENT }}
          OCI_CLI_REGION: ${{ secrets.OCI_REGION }}
          REPO_IMAGE_NAME: ${{ env.REPO_IMAGE_NAME }}:sandbox
        with:
          command: |
            instance-agent command create
              --compartment-id ${{ secrets.OCI_COMPARTMENT_OCID }}
              --target "{ 
                \"instanceId\":\"${{ secrets.OCI_SANDBOX_INSTANCE_OCID }}\"
              }"
              --content "{
                \"source\":{
                  \"sourceType\":\"TEXT\",
                  \"text\":\"
                    echo '${{ secrets.OCI_TOKEN }}' | docker login ${{ env.OCI_CONTAINER_REGISTRY }} -u ${{ secrets.OCI_REGISTRY_USERNAME }} --password-stdin &&
                    docker pull ${{ env.REPO_IMAGE_NAME }} &&
                    docker stop ${{ vars.CONTAINER_NAME }} || true &&
                    docker rm ${{ vars.CONTAINER_NAME }} || true &&
                    docker run -d -p 80:80 --name ${{ vars.CONTAINER_NAME }} ${{ env.REPO_IMAGE_NAME }}\"
                },
                \"output\":{
                  \"outputType\":\"TEXT\"
                }
              }" 
              --timeout-in-seconds 3600 
              --display-name ${{ github.sha }}-deployment
          silent: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions