Comments (6)
I am able to use dep
with codebuild fine when properly define a SRC_DIR
in buildspec.yaml
and if the submitter is root
meaning click start build directly in codebuild
env:
variables:
SRC_DIR: src/github.com/xxx/xxx
in the build logs there should be
CODEBUILD_SRC_DIR=/codebuild/output/src694249801/src/github.com/xxx/xxx
However, if I were to use codepipeline to be a submitter, it doesn't seem to create a directory defined in buildspec and this causes dep
to fail
This error
root project import: dep does not currently support using GOPATH/src as the project root
Build logs
CODEBUILD_SRC_DIR=/codebuild/output/src127950602/src
would love to know how to solve this.
from aws-codebuild-docker-images.
Thanks for your answer @clareliguori; I think it might be very useful to give an example of building a golang project with sub packages and dep with codebuild.
from aws-codebuild-docker-images.
Another workaround for dep:
If you echo $GOPATH
, we will get /go:/codebuild/output/src265478100
. So if you simply copy all contents of vendor/
contents to /go
, build succeeds for me. I'm running aws managed go 1.10.x machine image in codebuild config.
version: 0.2
env:
variables:
GOOS: "linux"
phases:
install:
commands:
- echo CODEBUILD_SRC_DIR - $CODEBUILD_SRC_DIR
- echo GOPATH - $GOPATH
- echo GOROOT - $GOROOT
- echo Moving packages
- cp -r ./vendor/* /go/src/
build:
commands:
- echo Build started on `date`
- echo Compiling the Go code...
- go build -o app main.go
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- app
- appspec.yml
- buildspec.yml
- codedeploy/*
Catch here is - you have to commit vendor/
to git. Which is fine because many projects commit all the deps to the repo to have one solid working unit without relying on packages/repos disappearing from remotes.
from aws-codebuild-docker-images.
@apisit I'm running into the same issue with dep - documented on golang/dep#417
This is how I worked around it in my buildspec file:
phases:
pre_build:
commands:
- mkdir -p ../github.com/sapessi/xxxxxxx
- mv * ../github.com/sapessi/xxxxxxx
- mv ../github.com .
- cd github.com/sapessi/xxxxxxx && dep ensure
...
from aws-codebuild-docker-images.
Thanks for reporting this @rvdwijngaard! We're working on getting the dep permissions fixed in our internal release process. In the meantime, chmod +x /go/bin/dep
in your buildspec should get your build going.
from aws-codebuild-docker-images.
Fixed f524c81
from aws-codebuild-docker-images.
Related Issues (20)
- Question: Image used to build Android project HOT 2
- Looking for guidance for Local CodeBuild and using CodeBuild Environement Variables.
- Feature request: Golang 1.21 support HOT 2
- cannot get codebuild_build.sh to work with aws/codebuild/amazonlinux2-x86_64-standard:corretto11
- `docker run` fails with `failed to start daemon: error initializing graphdriver: driver not supported` HOT 1
- Support Java 21 runtime HOT 10
- Feature request: Python 3.12 support HOT 3
- docker error HOT 2
- Support podman in codebuild_build.sh
- Running aarch64 codebuild image on a x86_64 machine HOT 2
- No longer able to use "n 18.16.0" in build using aws/codebuild/amazonlinux2-x86_64-standard:5.0 HOT 9
- support dotnet version 8 HOT 2
- EMFILE and EBUSY errors in node 20 HOT 3
- [URGENT] Looking forward to add support for DotNET 8.0 in CodeBuild. HOT 1
- Python 3.12 runtime support HOT 1
- Add support for Node 20 in ARM images HOT 2
- PHP 8.3 Support HOT 4
- local CodeBuild does not seem to perform caching
- aws/codebuild/standard:7.0-24.1.13 and 23.12.14 failing Lambda layer Makefile SAM build
- Docker 25 support HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-codebuild-docker-images.