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

Feature/bitbucket env #225

Merged
merged 5 commits into from
Nov 18, 2019
Merged

Conversation

KajdeMunter
Copy link
Contributor

@KajdeMunter KajdeMunter commented Nov 14, 2019

Purpose

Fixes #223

I also added the BITBUCKET_COMMIT environment variable.

Tests and Risks?

Tests were already in place but added BITBUCKET_COMMIT variable.

@drazisil drazisil self-requested a review November 18, 2019 17:33
Copy link
Contributor

@drazisil drazisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you @KajdeMunter

@drazisil drazisil merged commit 11d806b into codecov:master Nov 18, 2019
@drazisil drazisil added bug needs deployment This PR will need a new deployment labels Nov 18, 2019
@Slamdunk
Copy link
Contributor

Slamdunk commented Dec 6, 2019

Hi, in a repo on Bitbucket I had no issue until 950b21e included.
Starting from 4983e44 I repetedly get the following error.

Full diff 950b21e...4983e44 tells this is the only PR involving Bitbucket.

+ codecov -f tmp/clover.xml
  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-20191120-4983e44
==> Bitbucket detected.
    project root: .
--> token set from env
    Yaml found at: codecov.yml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + tmp/clover.xml bytes=2342173
==> Appending adjustments
    http://docs.codecov.io/docs/fixing-reports
    + Found adjustments
==> Gzipping contents
==> Uploading reports
    url: https://codecov.io
    query: branch=OMISSIS&commit=07816c12f12b&build=737&build_url=&name=&tag=&slug=OMISSIS%2FOMISSIS&service=bitbucket&flags=&pr=149&job=737
    -> Pinging Codecov
https://codecov.io/upload/v4?package=bash-20191120-4983e44&token=secret&branch=OMISSIS&commit=07816c12f12b&build=737&build_url=&name=&tag=&slug=OMISSIS%2FOMISSIS&service=bitbucket&flags=&pr=149&job=737
    -> Uploading
    X> Failed to upload
    -> Sleeping for 30s and trying again...
    -> Pinging Codecov
https://codecov.io/upload/v4?package=bash-20191120-4983e44&token=secret&branch=OMISSIS&commit=07816c12f12b&build=737&build_url=&name=&tag=&slug=OMISSIS%2FOMISSIS&service=bitbucket&flags=&pr=149&job=737
    -> Uploading
    X> Failed to upload
    -> Sleeping for 30s and trying again...
    -> Pinging Codecov
https://codecov.io/upload/v4?package=bash-20191120-4983e44&token=secret&branch=OMISSIS&commit=07816c12f12b&build=737&build_url=&name=&tag=&slug=OMISSIS%2FOMISSIS&service=bitbucket&flags=&pr=149&job=737
    -> Uploading
    X> Failed to upload
    -> Sleeping for 30s and trying again...
    -> Pinging Codecov
https://codecov.io/upload/v4?package=bash-20191120-4983e44&token=secret&branch=OMISSIS&commit=07816c12f12b&build=737&build_url=&name=&tag=&slug=OMISSIS%2FOMISSIS&service=bitbucket&flags=&pr=149&job=737
    -> Uploading
    X> Failed to upload
    -> Sleeping for 30s and trying again...
    -> Uploading to Codecov
    HTTP 400
commit must match pattern ^\d+:\w{12}|\w{40}$

The bitbucket-pipelines.yml is pretty straightforward:

customdefinitions:
  - phptest: &phptest
      name: PHP Tests
      image: zoeslam/docker-php:7.3
      script:
        - composer install --ansi --classmap-authoritative
        - vendor/bin/phpunit --color=always --configuration=cc.xml --coverage-clover=tmp/clover.xml
        - codecov -f tmp/clover.xml

pipelines:
  pull-requests:
    '**':
      - step: *phptest
  branches:
    master:
      - step: *phptest

And this is the Dockerfile for the base image: https://github.com/Slamdunk/docker-php/blob/master/7.3.Dockerfile

Any guess on what could be happening?

@KajdeMunter
Copy link
Contributor Author

KajdeMunter commented Dec 6, 2019

@Slamdunk What is the value of your BITBUCKET_COMMIT environment variable?

@Slamdunk
Copy link
Contributor

Slamdunk commented Dec 6, 2019

This is (part of) printenv (with OMISSIS on sensitive data):

BITBUCKET_BRANCH=codecov_debug
BITBUCKET_BUILD_NUMBER=751
BITBUCKET_CLONE_DIR=/opt/atlassian/pipelines/agent/build
BITBUCKET_COMMIT=3fffce06e9e2
BITBUCKET_DOCKER_HOST_INTERNAL=10.36.219.180
BITBUCKET_GIT_HTTP_ORIGIN=http://bitbucket.org/OMISSIS/OMISSIS
BITBUCKET_GIT_SSH_ORIGIN=git@bitbucket.org:OMISSIS/OMISSIS.git
BITBUCKET_PARALLEL_STEP=0
BITBUCKET_PARALLEL_STEP_COUNT=1
BITBUCKET_PROJECT_KEY=OMISSIS
BITBUCKET_PROJECT_UUID={OMISSISX-14fc-4a36-8d98-0361d16ef224}
BITBUCKET_PR_DESTINATION_BRANCH=master
BITBUCKET_PR_DESTINATION_COMMIT=fca79568d3ec
BITBUCKET_PR_ID=153
BITBUCKET_REPO_FULL_NAME=OMISSIS/OMISSIS
BITBUCKET_REPO_IS_PRIVATE=true
BITBUCKET_REPO_OWNER=OMISSIS
BITBUCKET_REPO_OWNER_UUID={OMISSISX-a82e-4918-91f7-d98d72d91b7f}
BITBUCKET_REPO_SLUG=OMISSIS
BITBUCKET_REPO_UUID={OMISSISX-d50c-48d5-aec1-b4ab9be0895f}
BITBUCKET_STEP_RUN_NUMBER=1
BITBUCKET_STEP_TRIGGERER_UUID={OMISSISX-eeee-43cd-867e-56b09dbfc444}
BITBUCKET_WORKSPACE=OMISSIS
CI=true

@KajdeMunter
Copy link
Contributor Author

Hmm.. Weird, I'm pretty sure BITBUCKET_COMMIT should be the full commit hash. The error message is correct, as ^\d+:\w{12}|\w{40}$ does not match 3fffce06e9e2 because of the \d+: part of the regex.

@Slamdunk
Copy link
Contributor

Slamdunk commented Dec 6, 2019

It seems the Pipeline is using this short version; these are the first lines of the Build step:

+ umask 000

+ GIT_LFS_SKIP_SMUDGE=1 git clone --branch="codecov_debug" https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...

+ git reset --hard 3fffce06e9e2
HEAD is now at 3fffce06 Debug for Codecov

What can we do about this?

@KajdeMunter
Copy link
Contributor Author

KajdeMunter commented Dec 6, 2019

Where did you run your printenv? Inside the container or the pipeline? Mine definitely uses the full commit hash.

@Slamdunk
Copy link
Contributor

Slamdunk commented Dec 6, 2019

Inside the pipeline

@KajdeMunter
Copy link
Contributor Author

Could it be some weird bitbucket bug? https://jira.atlassian.com/browse/BCLOUD-19393

@drazisil
Copy link
Contributor

drazisil commented Dec 6, 2019

This does look to be the cause. If the env doesn't give us what we need you will need to manually provide it with the -C flag.

@drazisil
Copy link
Contributor

drazisil commented Dec 6, 2019

I've moved this issue to here #241

Going to close this thread, since this PR is not the cause of the issue.

@codecov codecov locked as resolved and limited conversation to collaborators Dec 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug needs deployment This PR will need a new deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bitbucket Pipelines Support
3 participants