Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use test_commands in my pipeline #4768

Closed
qnm opened this issue Apr 18, 2023 · 6 comments
Closed

Unable to use test_commands in my pipeline #4768

qnm opened this issue Apr 18, 2023 · 6 comments
Labels
guidance Issue requesting guidance or information about usage pending/question Further information is requested. stale

Comments

@qnm
Copy link

qnm commented Apr 18, 2023

Hi,

I have configured a pipeline with a test_commands option which I intend to use to notify systems of a deployment.

> copilot -v
copilot version: v1.27.0

I have run copilot pipeline update which I think ensures the latest template.

Having added a basic command to the YML, I am seeing the following error:

[Container] 2023/04/18 03:15:08 Waiting for agent ping
[Container] 2023/04/18 03:15:14 Phase context status code: YAML_FILE_ERROR Message: Unknown 
runtime version named '18' of docker. This build image has the following versions: 20

Buildspec contains:

version: 0.2
phases:
  install:
    runtime-versions:
      ruby: 3.1

Manifest contains:

 stages:
   - # The name of the environment.
    name: integration
    test_commands:
      - bin/deploy-integration-completed

The file bin/deploy-integration-completed is executable and contains a call to env only.

I'm not using anything other than the defaults, and a custom ruby version using rbenv

@bvtujo
Copy link
Contributor

bvtujo commented Apr 19, 2023

Hi @qnm, thanks for reporting this issue. Do you think you could share a little more information about your setup? For example, did you recently upgrade your Copilot version? And could you share the buildspec.yml which was generated by the pipeline init command?

If you've recently upgraded your Copilot version you may be getting bit by a mismatch between the docker version in the buildspec (18, last supported by AL2 Standard 2.0 Codebuild image and specified by default on Copilot <=1.13.0) and the docker versions available to the current Codebuild image (AL2 Standard 4.0).

The fix would be to update the docker version in your buildspec.yml to 20.

@bvtujo bvtujo added pending/question Further information is requested. guidance Issue requesting guidance or information about usage labels Apr 19, 2023
@lominming
Copy link

I'm also getting the same error when I try to add commands to the test_commands in manifest (of pipeline)
image

My buildspec looks like this:

# Buildspec runs in the build stage of your environment pipeline to generate the environment CloudFormation stack config.
version: 0.2
phases:
  install:
    runtime-versions:
      ruby: 3.1
    commands:
      - echo "cd into $CODEBUILD_SRC_DIR"
      - cd $CODEBUILD_SRC_DIR
      # Download the copilot linux binary. You can update this version.
      - wget -q https://ecs-cli-v2-release.s3.amazonaws.com/copilot-linux-v1.27.0
      - mv ./copilot-linux-v1.27.0 ./copilot-linux
      - chmod +x ./copilot-linux
  build:
    commands:
      - echo "Run your tests"
      # - make test
  post_build:
    commands:
      - ls -l
      - export COLOR="false"
      - export CI="true"
      - pipeline=$(cat $CODEBUILD_SRC_DIR/copilot/pipelines/app-main/manifest.yml | ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))')
      - stages=$(echo $pipeline | jq -r '.stages[].name')
      # Generate the cloudformation templates.
      - >
        for env in $stages; do
          ./copilot-linux env package -n $env --output-dir './infrastructure' --upload-assets --force;
          if [ $? -ne 0 ]; then
            echo "Cloudformation stack and config files were not generated. Please check build logs to see if there was a manifest validation error." 1>&2;
            exit 1;
          fi
        done;
      - ls -lah ./infrastructure
artifacts:
  files:
    - "infrastructure/*"

@lominming
Copy link

This could be the lines that needs updating?

install:
runtime-versions:
docker: 18

Manually trying to override/add version 20 in the buildspec does not work.

@Lou1415926
Copy link
Contributor

For ⬆️ issue by @lominming, see #4721!

@github-actions
Copy link

github-actions bot commented Jul 1, 2023

This issue is stale because it has been open 60 days with no response activity, and is tagged with pending/question. Remove the stale label, add a comment, or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jul 1, 2023
@github-actions
Copy link

This issue is closed due to inactivity. Feel free to reopen the issue if you have any follow-ups!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Issue requesting guidance or information about usage pending/question Further information is requested. stale
Projects
None yet
Development

No branches or pull requests

4 participants