Skip to content

Commit

Permalink
fix(issue-30): reproducer container
Browse files Browse the repository at this point in the history
have the image for better testing, user reports it is with copy.
  • Loading branch information
ktomk committed Oct 11, 2024
1 parent 7a5a88d commit af943ad
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,12 @@ pipelines:
git-runner:
- step:
name: "git runner"
image: debian:bookworm-slim
image: ktomk/pipelines:debian-git
script:
- git --version || (apt-get update && apt-get install -y git)
- git --version
- stat "$PWD"
- id -a
- ls -lah /app | head -n 12
- git rev-parse --show-toplevel
- git config --global --unset-all safe.directory
- git rev-parse --show-toplevel || true
Expand Down
44 changes: 44 additions & 0 deletions lib/container/debian-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# this file is part of pipelines
#
# pipelines:debian-git docker image
#
# usage: ./debian-git.sh [<docker-cmd>]
#
# <docker-cmd> "docker" by default
#
# requirements: docker (or equivalent)
#
# rationale:
#
# bitbucket pipelines has a problem deploying files that git
# unveils as a dubious ownership and a user requested it.
#
# <https://github.com/ktomk/pipelines/issues/30#issuecomment-2395134681>
#
set -euo pipefail
IFS=$' \n\t'

docker_cmd="${1-docker}"
from="docker.io/debian:bookworm-slim"
tag="docker.io/ktomk/pipelines:debian-git"

echo "build '${tag}' from '${from}' with ${docker_cmd}..."

<<'DOCKERFILE' "${docker_cmd}" build --build-arg FROM="${from}" -t "${tag}" - | sed -e 's/^/ build: /'
ARG FROM
FROM $FROM
RUN apt-get update && \
apt-get install -qy git
DOCKERFILE

echo "test '${tag}' ..."

# shellcheck disable=SC2016
"${docker_cmd}" run --rm "${tag}" git --version

echo "push '${tag}' ..."

"${docker_cmd}" push "${tag}" | sed -e 's/^/ push.: /'

echo "done."

0 comments on commit af943ad

Please sign in to comment.