Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

pipes in after-scripts doesn't seem to work on self hosted runners

Aaron.Luo
Contributor
January 31, 2022

This might be a bug of pipes in after-scripts on self hosted runners.

I have a step in my bitbucket pipeline as follows:

 

- step:

     name: Build and Test

runs-on:

  - self.hosted

  - k8s

caches:

  - maven

script:

  - mvn clean install

after-script:

  - pipe: atlassian/checkstyle-report:0.3.1

     variables:

        DEBUG: "true"

services:

  - docker

artifacts: 

  - target/surefire-reports/**

  - target/checkstyle-result.xml

  - target/*.jar

`mvn clean install` ran as expected. I could see the jar file, surefire-reports/ and checkstyle-result.xml were generated in "/tmp/8b5a4a4f-f711-583f-95bd-*********/build/target/" directory, I could also see it's mounted to "/opt/atlassian/pipelines/agent/build" within the docker:dind container, but the "checkstyle-report" pipe failed to access "/tmp/8b5a4a4f-f711-583f-95bd-*********/build".

From the `docker container run ***` command, the build seems to be mounted to "/opt/atlassian/pipelines/agent/build" in the checkstyle-report container, but the workdir was set to $(pwd) (i.e. "/tmp/8b5a4a4f-f711-583f-95bd-*********/build") which didn't exist for sure.

Below are the logs of after script:

After script

pipe: atlassian/checkstyle-report:0.3.11m 0s

+ docker container run \


--volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \

--volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \

--volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \

--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \

--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/checkstyle-report:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/checkstyle-report \

--workdir=$(pwd) \

--label=org.bitbucket.pipelines.system=true \

--env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \

--env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \

--env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \

--env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \

--env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \

--env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \

--env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \

--env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \

--env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \

--env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \

--env=BITBUCKET_PARALLEL_STEP_COUNT="$BITBUCKET_PARALLEL_STEP_COUNT" \

--env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \

--env=CI="$CI" \

--env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \

--env=BITBUCKET_PARALLEL_STEP="$BITBUCKET_PARALLEL_STEP" \

--env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \

--env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \

--env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \

--env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \

--env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \

--env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \

--env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \

--env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \

--env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \

--env=DOCKER_HOST="tcp://host.docker.internal:2375" \

--env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \

--env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/checkstyle-report" \

--env=CHECKSTYLE_REPORT_ID="checkstyle-1" \

--env=CHECKSTYLE_RESULT_PATTERN=".*/checkstyle-result.xml$" \

--env=DEBUG="true" \

--env=REPORT_FAIL_SEVERITY="info" \

--env=BITBUCKET_EXIT_CODE="$BITBUCKET_EXIT_CODE" \

--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \

bitbucketpipelines/checkstyle-report:0.3.1

Unable to find image 'bitbucketpipelines/checkstyle-report:0.3.1' locally

0.3.1: Pulling from bitbucketpipelines/checkstyle-report

e7c96db7181b: Pulling fs layer

f910a506b6cb: Pulling fs layer

b6abafe80f63: Pulling fs layer

c66155a2e96a: Pulling fs layer

c66155a2e96a: Waiting

f910a506b6cb: Download complete

e7c96db7181b: Verifying Checksum

e7c96db7181b: Download complete

e7c96db7181b: Pull complete

f910a506b6cb: Pull complete

c66155a2e96a: Verifying Checksum

c66155a2e96a: Download complete

b6abafe80f63: Verifying Checksum

b6abafe80f63: Download complete

b6abafe80f63: Pull complete

c66155a2e96a: Pull complete

Digest: sha256:ce5e8b7e249979ec3fb8e731bc3a26ccaee32e280996dcbaacf1f76eb2924f30

Status: Downloaded newer image for bitbucketpipelines/checkstyle-report:0.3.1

Exception in thread "main" java.lang.RuntimeException: /tmp/8b5a4a4f-f711-583f-95bd-*********/build not found

at se.bjurr.violations.lib.ViolationsApi.inFolder(ViolationsApi.java:45)

at com.atlassian.bitbucket.pipelines.checkstyle.report.Main.main(Main.java:95)

1 answer

1 accepted

0 votes
Answer accepted
Aaron.Luo
Contributor
February 1, 2022

Update: After I upgrade pipelines runner to 1.287, the above issue seems to have resolved.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events