Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

AWS CodeBuild with CodePipeline NoMethodError #126

Open
klausbadelt opened this issue Jan 11, 2021 · 8 comments
Open

AWS CodeBuild with CodePipeline NoMethodError #126

klausbadelt opened this issue Jan 11, 2021 · 8 comments

Comments

@klausbadelt
Copy link
Contributor

When running CodeBuild via CodePipeline, the CI provider is not detected. Also, there's no git repository with CodePipeline as source provider in CodeBuild, so branch and commit detection fail too.

Lcov style coverage report generated for Minitest to /srv/coverage/lcov/lcov.info
80 | Coverage report generated for Minitest to /srv/coverage. 3407 / 5298 LOC (64.31%) covered.
81 |  
82 | _____          _
83 | / ____\|        \| \|
84 | \| \|     ___   __\| \| ___  ___ _____   __
85 | \| \|    / _ \ / _\`\|/ _ \/ __/ _ \ \ / /
86 | \| \|___\| (_) \| (_\| \|  __/ (_\| (_) \ V /
87 | \_____\___/ \__,_\|\___\|\___\___/ \_/
88 | Ruby-0.2.15
89 | x> No CI provider detected.
90 | ==> Appending file network
91 | fatal: not a git repository (or any of the parent directories): .git
92 | fatal: not a git repository (or any of the parent directories): .git
93 | ==> Gzipping contents
94 | ==> Uploading reports
95 | url:   https://codecov.io
96 | query: token=secret&flags=rails&package=ruby-0.2.15&branch=&commit=
97 | ->  Pinging Codecov
98 | https://codecov.io/upload/v4?token=secret&flags=rails&package=ruby-0.2.15&branch=&commit=
99 |  
100 | <!DOCTYPE html>
101 | <html lang="en">
102 | <head>
103 | <meta charset="utf-8">
104 | <meta http-equiv="X-UA-Compatible" content="IE=edge">
105 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
106 | <meta name="description" content="Code coverage done right. Highly integrated with GitHub, Bitbucket and GitLab.">
107 | <meta name="author" content="@codecov">
108 | <meta name="keywords" content="code, coverage, analysis, testing, development, qa, analyzer">
109

@klausbadelt
Copy link
Contributor Author

We're testing in a Docker container, so once I passed thru CODEBUILD_BUILD_ID, CODEBUILD_CI, CODEBUILD_RESOLVED_SOURCE_VERSION, CODEBUILD_SOURCE_REPO_URL, CODEBUILD_SOURCE_VERSION
and CODEBUILD_WEBHOOK_HEAD_REF as required by this gem, detection started working.

Now the upload fails with NoMethodError. The env vars are populated differently when using CodePipeline.

_____          _
--
479 | / ____\|        \| \|
480 | \| \|     ___   __\| \| ___  ___ _____   __
481 | \| \|    / _ \ / _\`\|/ _ \/ __/ _ \ \ / /
482 | \| \|___\| (_) \| (_\| \|  __/ (_\| (_) \ V /
483 | \_____\___/ \__,_\|\___\|\___\___/ \_/
484 | Ruby-0.2.15
485 | ==> Codebuild CI detected
486 | ==> Appending file network
487 | Formatter SimpleCov::Formatter::Codecov failed with NoMethodError: undefined method `split' for nil:NilClass (/bundle/ruby/2.6.0/bundler/gems/codecov-ruby-f360765cebce/lib/codecov.rb:166:in `build_params')

@klausbadelt klausbadelt changed the title AWS CodeBuild not detected with CodePipeline AWS CodeBuild with CodePipeline NoMethodError Jan 11, 2021
@thomasrockhu
Copy link
Contributor

@klausbadelt what is the value of CODEBUILD_WEBHOOK_HEAD_REF?

@klausbadelt
Copy link
Contributor Author

@thomasrockhu It's not set. Here's all CODEBUILD_* env vars set when using CodePipeline:

CODEBUILD_AGENT_ENDPOINT=http://127.0.0.1:7831
CODEBUILD_AUTH_TOKEN=***
CODEBUILD_BMR_URL=https://CODEBUILD_AGENT:3000
CODEBUILD_BUILD_ARN=arn:aws:codebuild:us-east-1:***:build/RailsBuild-***:ff4472d5-****-****-****-7778d08afca2
CODEBUILD_BUILD_ID=RailsBuild-***:ff4472d5-****-****-****-7778d08afca2
CODEBUILD_BUILD_IMAGE=aws/codebuild/standard:4.0
CODEBUILD_BUILD_NUMBER=153
CODEBUILD_BUILD_SUCCEEDING=1
CODEBUILD_BUILD_URL=https://us-east-1.console.aws.amazon.com/codebuild/home?region=us-east-1#/builds/RailsBuild-***:ff4472d5-****-****-****-7778d08afca2/view/new
CODEBUILD_CI=true
CODEBUILD_CONTAINER_NAME=default
CODEBUILD_EXECUTION_ROLE_BUILD=
CODEBUILD_FE_REPORT_ENDPOINT=https://codebuild.us-east-1.amazonaws.com/
CODEBUILD_GOPATH=/codebuild/output/src107763158
CODEBUILD_INITIATOR=codepipeline/ci-dev-RailsPipeline-****
CODEBUILD_KMS_KEY_ID=arn:aws:kms:us-east-1:***:alias/aws/s3
CODEBUILD_LAST_EXIT=0
CODEBUILD_LOG_PATH=uuid***
CODEBUILD_PROJECT_UUID=uuid***
CODEBUILD_RESOLVED_SOURCE_VERSION=a4845d69a276b747ab4c4bc59c917fa5430989d0
CODEBUILD_SOURCE_VERSION=arn:aws:s3:::ci-dev-deploybucket-***/ci-dev-RailsPipeline/RailsSourc/*****
CODEBUILD_SRC_DIR=/codebuild/output/src107763158/src
CODEBUILD_START_TIME=1610666751389

@thomasrockhu
Copy link
Contributor

@klausbadelt I see, I'll look into getting this changed! Thanks for your patience.

@klausbadelt
Copy link
Contributor Author

Haha thank you. Sorry for the delay in response.

I think I had this covered in #35 but things have probably changed since then. Lemme know if a PR would help you.

@thomasrockhu
Copy link
Contributor

😆 sorry about that @klausbadelt. Yes, another PR would be extremely helpful

@thomasrockhu thomasrockhu self-assigned this Jan 21, 2021
@klausbadelt
Copy link
Contributor Author

You probably saw - #131 has been posted

@thomasrockhu
Copy link
Contributor

@klausbadelt, I'll push a new version of the uploader next week, thanks for the PR!

@thomasrockhu thomasrockhu removed their assignment Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants