slimtoolkit / slimtoolkit/slim

mint sensor writing to unauthorized directory in bitbucket pipeline

Open
#833 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Go
Stars
23.4k
Forks
840
PR merge metrics
No merged PRs in 30d

Description

Overview

Hi, I'm trying to integrate docker slim to reduce the size of docker images. I have a pipe.sh script in a repo that creates and pushes docker images to dockerhub. In this pipe.sh I'm building the regular docker image first and then slimming it right after.

Problem

Since the only writeable path is any subdirectory of BITBUCKET_CLONE_DIR, I made a subdirectory called "slim-state" which is where docker-slim writes some metadata. Even after doing this I'm getting this error:

level=fatal msg="slim: failure" error="API error (403): authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories"

This is how I'm using slim:

echo "Running docker-slim on image..."
SLIM_IMAGE_TAG=${IMAGE_TAG}-slim
SLIM_STATE_DIR="$BITBUCKET_CLONE_DIR/slim-state"
mkdir -p ${SLIM_STATE_DIR}
slim
--verbose
--debug
--state-path ${SLIM_STATE_DIR}
build
--tag $NAME:${SLIM_IMAGE_TAG}
--target $NAME:${IMAGE_TAG}
--http-probe=true \

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pipe.sh invocation shown in the report and inspect how slim handles --state-path in a Bitbucket Pipeline. Reproduce the command with SLIM_STATE_DIR under BITBUCKET_CLONE_DIR and trace which path triggers the authorization error. Done means the slimming command completes without requesting an unauthorized write path.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.