Skip to content

Commit

Permalink
Build Docker image based on repository state (as opposed to PyPI pack…
Browse files Browse the repository at this point in the history
…age)
  • Loading branch information
PawelLipski committed Jan 15, 2022
1 parent 1a35c13 commit 1882d66
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ jobs:

- deploy:
name: '[Dry run] Publish image to Docker Hub'
# Prerequisites: artifacts must be released to test PyPI first
command: bash ci/docker/ci-deploy.sh --dry-run

- deploy:
Expand All @@ -130,7 +129,6 @@ jobs:

- deploy:
name: '[Dry run] Build snap'
# Side effects: none
command: bash ci/snap/ci-run-dry-run.sh

- deploy:
Expand All @@ -154,7 +152,6 @@ jobs:

- deploy:
name: 'Publish image to Docker Hub'
# Prerequisites: artifacts must be released to PyPI first
command: bash ci/docker/ci-deploy.sh

- deploy:
Expand Down
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*

!git_machete/
!git-machete
!MANIFEST.in
!README.md
!requirements.txt
!setup.py

git_machete/tests/
**/*.pyc
**/__pycache__/
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release notes

## New in git-machete 3.7.1

- fixed: build process of Docker images

## New in git-machete 3.7.0

- added: extra options can be passed to the underlying `git rebase` via `GIT_MACHETE_REBASE_OPTS` env var (suggested by @kgadek)
Expand Down
16 changes: 10 additions & 6 deletions ci/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM python:3-alpine
RUN apk update
RUN apk add git
SHELL ["/bin/sh", "-e", "-o", "pipefail", "-u", "-x", "-c"]
RUN apk add --no-cache git

ARG pypi_host
ARG version
RUN pip install --index-url=https://$pypi_host/simple/ git-machete==$version
RUN git machete --version
COPY . /tmp/input/
WORKDIR /tmp/input/
RUN find . | sort
RUN \
export PYTHONDONTWRITEBYTECODE=1; \
python setup.py install; \
git machete --version; \
rm -rf /tmp/input/

WORKDIR /repo
VOLUME /repo
Expand Down
6 changes: 1 addition & 5 deletions ci/docker/ci-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ set -e -o pipefail -u -x

if [[ ${1-} == "--dry-run" || ${CIRCLE_BRANCH-} != "master" ]]; then
do_push=false
pypi_host=test.pypi.org
else
do_push=true
pypi_host=pypi.org
fi

version=$(grep '__version__ = ' git_machete/__init__.py | cut -d\' -f2)

docker build \
--build-arg pypi_host=$pypi_host \
--build-arg version=$version \
-t gitmachete/git-machete:$version \
-t gitmachete/git-machete:latest \
- < ci/docker/Dockerfile
-f ci/docker/Dockerfile .

[[ $(docker run gitmachete/git-machete:latest --version) == "git machete version $version" ]]

Expand Down
2 changes: 1 addition & 1 deletion git_machete/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.7.0'
__version__ = '3.7.1'

0 comments on commit 1882d66

Please sign in to comment.