===============
I'm new to AWS CodeBuild. We are trying it for the first time. I set up my Buildspec.yml file and when I run it I get errors indicating that it cd: can't cd to /codebuild/output/src.... throughout the build run, however it progresses to the next step each time disregarding the errors. However, when it gets to the artifacts step it can't find the artifacts path. I've tried many iterations of the artifacts: files: statements with no luck. I'm not sure if the cd errors and the artifact issue are related.
Here is the Buildspec file currently. I've also attempted several different versions of the "files:" statement including - '**/*'
buildspec.yml
version: 0.2
phases:
install:
commands:
- echo Nothing to do in the install phase...
pre_build:
commands:
- echo Nothing to do in the pre_build phase...
build:
commands:
- echo Build started on `date`
- echo $CODEBUILD_SRC_DIR
- uServices/hello-world-java/gradlew build
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- uServices/hello-world-java/build/distributions/*
output from the codebuild
[Container] 2019/01/31 14:19:42 Waiting for agent ping
[Container] 2019/01/31 14:19:43 Waiting for DOWNLOAD_SOURCE
[Container] 2019/01/31 14:19:44 Phase is DOWNLOAD_SOURCE
[Container] 2019/01/31 14:19:44 CODEBUILD_SRC_DIR=/codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
[Container] 2019/01/31 14:19:44 YAML location is /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git /buildspec.yml
[Container] 2019/01/31 14:19:44 Processing environment variables
[Container] 2019/01/31 14:19:44 Moving to directory /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
[Container] 2019/01/31 14:19:44 Registering with agent
[Container] 2019/01/31 14:19:44 Phases found in YAML: 4
[Container] 2019/01/31 14:19:44 POST_BUILD: 1 commands
[Container] 2019/01/31 14:19:44 INSTALL: 1 commands
[Container] 2019/01/31 14:19:44 PRE_BUILD: 1 commands
[Container] 2019/01/31 14:19:44 BUILD: 3 commands
[Container] 2019/01/31 14:19:44 Phase complete: DOWNLOAD_SOURCE Success: true
[Container] 2019/01/31 14:19:44 Phase context status code: Message:
[Container] 2019/01/31 14:19:44 Entering phase INSTALL
[Container] 2019/01/31 14:19:44 Running command echo Nothing to do in the install phase...
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
Nothing to do in the install phase...
[Container] 2019/01/31 14:19:44 Phase complete: INSTALL Success: true
[Container] 2019/01/31 14:19:44 Phase context status code: Message:
[Container] 2019/01/31 14:19:45 Entering phase PRE_BUILD
[Container] 2019/01/31 14:19:45 Running command echo Nothing to do in the pre_build phase...
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
Nothing to do in the pre_build phase...
[Container] 2019/01/31 14:19:45 Phase complete: PRE_BUILD Success: true
[Container] 2019/01/31 14:19:45 Phase context status code: Message:
[Container] 2019/01/31 14:19:45 Entering phase BUILD
[Container] 2019/01/31 14:19:45 Running command echo Build started on `date`
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
Build started on Thu Jan 31 14:19:45 UTC 2019
[Container] 2019/01/31 14:19:45 Running command echo $CODEBUILD_SRC_DIR
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
/codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
[Container] 2019/01/31 14:19:45 Running command uServices/hello-world-java/gradlew build
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
Downloading https://services.gradle.org/distributions/gradle-3.5-bin.zip
..........................................................................................................................................................................................................................................................................................
Unzipping /root/.gradle/wrapper/dists/gradle-3.5-bin/daoimhu7k5rlo48ntmxw2ok3e/gradle-3.5-bin.zip to /root/.gradle/wrapper/dists/gradle-3.5-bin/daoimhu7k5rlo48ntmxw2ok3e
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-3.5-bin/daoimhu7k5rlo48ntmxw2ok3e/gradle-3.5/bin/gradle
Starting a Gradle Daemon (subsequent builds will be faster)
:buildEnvironment
------------------------------------------------------------
Root project
------------------------------------------------------------
classpath
No dependencies
BUILD SUCCESSFUL
Total time: 8.74 secs
[Container] 2019/01/31 14:19:56 Phase complete: BUILD Success: true
[Container] 2019/01/31 14:19:56 Phase context status code: Message:
[Container] 2019/01/31 14:19:56 Entering phase POST_BUILD
[Container] 2019/01/31 14:19:56 Running command echo Build completed on `date`
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
Build completed on Thu Jan 31 14:19:56 UTC 2019
[Container] 2019/01/31 14:19:56 Phase complete: POST_BUILD Success: true
[Container] 2019/01/31 14:19:56 Phase context status code: Message:
[Container] 2019/01/31 14:19:56 Expanding base directory path: .
[Container] 2019/01/31 14:19:56 Assembling file list
[Container] 2019/01/31 14:19:56 Expanding /codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
.
[Container] 2019/01/31 14:19:56 Expanded to /codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
.
[Container] 2019/01/31 14:19:56 Skipping invalid artifact path /codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
/codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
.
[Container] 2019/01/31 14:19:56 Phase complete: UPLOAD_ARTIFACTS Success: false [Container] 2019/01/31 14:19:56 Phase context status code: CLIENT_ERROR Message: no matching base directory path found for /codebuild/output/tmp/script.sh: 1: cd: can't cd to /codebuild/output/src590503358/src/github.com/SomosEngineering/tss-modern.git
Summary
In my development area I can run Gradle and see the .zip artifact sitting in the following directory as below. I would expect codebuild to find it and load it to S3. [clipford@NVA-1a-TSS-DEV01
distributions]$ pwd
/home/clipford/work/tss-modern/uServices/hello-world-java/build/distributions
[clipford@NVA-1a-TSS-DEV01 distributions]$ ls
tss-modern-clipford.zip