Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. version: 0.2
  2.  
  3. env:
  4. variables:
  5. GOROOT: "/usr/local/go"
  6. GO111MODULE: "on"
  7. GOARCH: "amd64"
  8. GOOS: "linux"
  9. PUBLISHERS: "inner-products variant-branches"
  10.  
  11. phases:
  12. install:
  13. runtime-versions:
  14. golang: 1.12
  15. commands:
  16. # AWS Codebuild Go images use /go for the $GOPATH so let's copy our
  17. # application source code into that directory structure.
  18. # Print all environment variables (handy for AWS CodeBuild logs)
  19. # - env | sort # BAM: We don't need to see this on every build so comment it out
  20. # Install golint
  21. # go get -u github.com/golang/lint/golint
  22.  
  23. pre_build:
  24. commands:
  25. # - cd $CODEBUILD_SRC_DIR # BAM: We don't need to cd into the folder here, and then again inside the for loop?
  26. # - mkdir -p $CODEBUILD_SRC_DIR/bin
  27. - |
  28. for publisher in $PUBLISHERS; do
  29. # cd "${CODEBUILD_SRC_DIR}" # BAM: Do we need to cd here to do the following ln? I don't see a need to cd?
  30. ln -s "${CODEBUILD_SRC_DIR}/${publisher}" "/go/src/${publisher}"
  31. cd /go/src/${publisher}
  32. # pwd; ls -alF # BAM: We don't need to see this everytime
  33. # go get -t ./...
  34. go mod download
  35. #golint -set_exit_status
  36. go vet .
  37. go test .
  38. done
  39.  
  40. build:
  41. commands:
  42. # - cd $CODEBUILD_SRC_DIR # BAM: Do we need to cd again?
  43. # - mkdir -p $CODEBUILD_SRC_DIR/bin
  44. - |
  45. for publisher in $PUBLISHERS; do
  46. cd /go/src/${publisher}
  47. # echo "Building '${publisher}' in `pwd`..." # BAM: Don't really need this echo cluttering the output do we?
  48. # go get github.com/aws/aws-lambda-go/lambda # BAM: Do we need to go get this specific library? we are using mod everywhere else, and we also include this library in our go application, which is pulled using the go mod download on line 34
  49. # go get -t ./...
  50. # go mod download # BAM: Do we really need to do a go mod download again?
  51. GOOS=linux go build -o $CODEBUILD_SRC_DIR/${publisher}/main # BAM: Should this just be at the end of the loop on line 37.5? I don't see a need to do another loop just for this?
  52. done
  53.  
  54. post_build:
  55. commands:
  56. - cd $CODEBUILD_SRC_DIR # BAM: Do we need to cd into this folder? I think we might so leaving it
  57. - aws cloudformation package --template-file samLambdaTemplate.yaml --s3-bucket ${S3_BUCKET} --kms-key-id ${SAM_KEY} --output-template-file packaged-template.yaml
  58.  
  59. artifacts:
  60.  
  61. files:
  62. - packaged-template.yaml
  63. # BAM: The below files are not needed to zip up into the artifact because the CFN stack loads those files into a secret
  64. # black magic S3 folder location and somehow links the Lambdas to those.
  65. # - inner-products
  66. # - variant-branches
  67. # "**/*"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement