BitBucket Pipeline log has no output when using custom image

Viewed 898

I'm attempting to POC BitBucket Pipelines for some terraform work. I've got a self-hosted runner, running locally in my Docker environment, which is registered to my repository. This was set up following the generic instructions in the BitBucket UI.

My bitbucket-pipelines.yml file looks like this:

pipelines:
  branches:
    master:
      - step:
          runs-on: self.hosted
          image: hashicorp/terraform:latest
          name: 'Terraform Version'
          script:
            - terraform -v

Extremely basic, just run a terraform -v command on the hashicorp/terraform image.

The pipeline succeeds, and I can see the image is pulled, however there is absolutely no output in BitBucket from the container. All I see in the step log is:

Runner matching labels:
    - linux
    - self.hosted
Runner name: my-runner
Runner labels: self.hosted, linux
Runner version:
    current: 1.252
    latest: 1.252
Images used:
    build: hashicorp/terraform@sha256:984ac701744995019b1309b542de03535a63097444e72b8f248d0a0d95520443

Even a simple echo "string" script does not get to the logs as output. I find that really strange, and I must be missing something fundamental. I've scoured the docs and can't find anything.

Does anyone know how to get the output from a custom image into the Bitbucket logs?

2 Answers

Do you use Docker Desktop on Windows? You won't see any logs from containers if you use DockerDesktop (tested on 4.3.2) on Windows with WSL integration. That's due to container logs have another location and they're not available to bitbucket runner container.

-- Update --

There's a feature request to add local runners WSL full compatibility now. Pls vote if you need it too. https://jira.atlassian.com/browse/BCLOUD-21611

I had a similar issue where I was getting no logs in my Pipeline output UI, though the ultimate status was reflected correctly (i.e. pass or fail).

I was using the command provided by Bitbucket to create a Linux Docker runner, and I noticed it contains this volume definition:

... -v /var/lib/docker/containers:/var/lib/docker/containers:ro ...

However, I am using a custom data-root for docker (see this blog for details), so the path /var/lib/docker/containers doesn't exist on my host machine. So, I modified this volume to point at my data-root setting, and then the logs showed up as expected.

Related