<p>In the CodeBuild "Artifacts" configuration, there is an "Add Artifact" button.</p>

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

CC BY-SA 4.0
2019-06-07T03:16:09.367Z
2019-06-07T03:16:09.367Z
Jason
<p>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</p>

<pre><code>version: 0.2 

phases: 
  install: 
    runtime-versions: 
      java: openjdk8 
    commands: 
      - apt update -y &amp;&amp; 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 
</code></pre>

<p>codebuild-output:</p>

<pre><code>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: 
</code></pre>

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

<amazon-web-services><amazon-s3><aws-codepipeline>
Artifacts mentioned in secondary-artifacts section not getting uploaded to s3 bucket
Rakesh.N
# Artifacts mentioned in secondary-artifacts section not getting uploaded to s3 bucket

(Asked by: username_0 on 2019-05-24)

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?

**Tags:** amazon-web-services, amazon-s3, aws-codepipeline


---

## 1 answers

### Answer by username_1 on 2019-06-07. Score: 3 | Accepted answer

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.


---

