1

I have created a codePipeline project through which my application get build using maven and it's artifacts are uploaded to s3. I'm trying to upload multiple artifacts as a single zip file to s3 bucket through codebuild. Below is my sample buildspec.yml file

version: 0.2 

phases: 
  install: 
    runtime-versions: 
      java: openjdk8 
    commands: 
      - apt update -y && apt install maven -y 
      - echo Install phase started on `date` 
      - echo Install phase ended on `date` 
  pre_build: 
    commands: 
      - echo Pre_build phase started on `date` 
      - bash pipelines/aws/scripts/onCheckout.sh 
      - echo Pre_build phase ended on `date` 
  build: 
    commands: 
      - echo Build phase started on `date` 
      - bash pipelines/aws/scripts/onBuild.sh 
      - echo Build phase ended on `date` 
  post_build: 
    commands: 
      - echo Post_build phase started on `date` 
      - bash pipelines/aws/scripts/onPackage.sh 
      - bash pipelines/aws/scripts/onPublish.sh 
      - bash pipelines/aws/scripts/onPromote.sh 
      - echo Post_build phase ended on `date` 
      - echo $CODEBUILD_SRC_DIR 
artifacts: 
  files: 
    - pipelines/**/* 
    - target/spring-petclinic-2.0.0.jar 
  base-directory: $CODEBUILD_SRC_DIR 
secondary-artifacts: 
  artifact1: 
    files: 
      - pipelines/aws/appspec.yml 
    base-directory: $CODEBUILD_SRC_DIR   
    discard-paths: yes 

codebuild-output:

https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Phase complete: POST_BUILD State: SUCCEEDED 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Phase context status code: Message: 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Expanding base directory path: $CODEBUILD_SRC_DIR 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Assembling file list 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Expanding /codebuild/output/src289881682/src 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Expanding artifact file paths for base directory /codebuild/output/src289881682/src 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Assembling file list 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Expanding pipelines/**/* 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Expanding target/spring-app-2.0.0.jar 
https://forums.aws.amazon.com/ 2019/05/24 12:00:27 Found 52 file(s) 
https://forums.aws.amazon.com/ 2019/05/24 12:00:28 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED 
https://forums.aws.amazon.com/ 2019/05/24 12:00:28 Phase context status code: Message: 

Artifacts mentioned in secondary-artifacts are completely ignored due to unknown reasons, Am I missing any parameters?

2

In the CodeBuild "Artifacts" configuration, there is an "Add Artifact" button.

You need to click that and reference your secondary artifact to get it to upload to S3 as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.