Skip to content

Commit

Permalink
Merge a149d93 into 9dc2dfe
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcs committed Aug 13, 2018
2 parents 9dc2dfe + a149d93 commit 14bbb1d
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .zappr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ approvals:
# Allow last committer / PR creator to approve as well.
# This will probably become the default in zappr.
ignore: none
X-Zalando-Team: "torch"
X-Zalando-Team: "automata"
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Hack to upload version to Pypi

FROM registry.opensource.zalan.do/stups/python AS builder
ARG VERSION
RUN apt-get update && \
apt-get install -q -y python3-pip && \
pip3 install -U tox setuptools
COPY . /build
WORKDIR /build
RUN sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" */__init__.py
RUN python3 setup.py sdist bdist_wheel

FROM pierone.stups.zalan.do/teapot/python-cdp-release:latest
COPY --from=builder /build/dist /pydist
35 changes: 35 additions & 0 deletions delivery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "2017-09-20"
notifications:
- channel: google_chat
rooms:
- AAAAxPNp15I
pipeline:
- id: build
type: script
overlay: ci/python
commands:
- desc: "Install dependencies"
cmd: pip install -r requirements.txt
- desc: "Run Tests"
cmd: python3 setup.py test
- desc: "Check code style"
cmd: python3 setup.py flake8
- desc: "Build docker image that will upload package"
cmd: |
VERSION=$(./next-version)
if [[ -z "${CDP_PULL_REQUEST_NUMBER}" ]]; then
DOCKER_IMAGE="pierone.stups.zalan.do/automata/kio-cli-release:${CDP_TARGET_REPOSITORY_COUNTER}"
else
DOCKER_IMAGE="pierone.stups.zalan.do/automata/kio-cli-release-pr:snapshot"
fi
docker build --build-arg VERSION="$VERSION" -t "$DOCKER_IMAGE" .
if [[ -z "${CDP_PULL_REQUEST_NUMBER}" ]]; then
docker push "$DOCKER_IMAGE"
git log -1 --pretty=%B > CHANGELOG
# TODO upload the wheel package
git gh-release --message-from-file CHANGELOG $VERSION
fi
# The actual release is done by a pipeline in Zalando's Internal Github Enterprise
30 changes: 30 additions & 0 deletions next-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3

import subprocess

MAJOR_VERSION = 0
MINOR_VERSION = 1


def get_latest_version() -> (int, int, int):
"""
Gets latest version based on Git Tags.
"""
proc = subprocess.run(['git', 'tag'], stdout=subprocess.PIPE)

versions = sorted(map(lambda version: tuple(int(sub)
for sub
in version.split('.')),
proc.stdout.decode().splitlines()))
return versions[-1]


if __name__ == '__main__':
major, minor, build = get_latest_version()

if major != MAJOR_VERSION or minor != MINOR_VERSION:
new_build = 0
else:
new_build = build + 1

print(f"{MAJOR_VERSION}.{MINOR_VERSION}.{new_build}")

0 comments on commit 14bbb1d

Please sign in to comment.