Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push a master-tagged image #142

Merged
merged 4 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ services:
language: nix
deploy:
provider: script
script: make dockerize && make docker-push
script: make dockerize && make docker-push VERSION="$TRAVIS_BRANCH"
on:
repo: smarkets/marge-bot
tags: true
condition: "$TRAVIS_TAG = $(cat version)"
all_branches: true
condition: "$TRAVIS_BRANCH = $(cat version) || $TRAVIS_BRANCH = master"
Copy link
Contributor

@aschmolck aschmolck Oct 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you want TRAVIS_TAG here somwhere? I don't get how we'd still get correctly v3.2.1 style tagged docker images with this (since what you docker push is always tagged as master, as far as I can tell).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Travis docs (https://docs.travis-ci.com/user/environment-variables/#default-environment-variables):
TRAVIS_BRANCH: for builds triggered by a tag, this is the same as the name of the tag (TRAVIS_TAG).
So I think this should work as expected.

env:
global:
# smarkets ci docker username
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VERSION?=$$(git rev-parse --abbrev-ref HEAD)

requirements_frozen.txt requirements.nix requirements_override.nix: requirements.txt
pypi2nix -V 3.6 -r $^

Expand Down Expand Up @@ -25,10 +27,15 @@ docker-push:
docker login; \
fi
docker tag smarkets/marge-bot:$$(cat version) smarkets/marge-bot:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think :latest should be :stable (meaning we can probably drop :stable, although I'm not opposed to it either). If you docker run smarkets/marge-bot, you should get a release version, IMO.

docker push smarkets/marge-bot:$$(cat version)
docker tag smarkets/marge-bot:$$(cat version) smarkets/marge-bot:$(VERSION)
if [ "$(VERSION)" = "$$(cat version)" ]; then \
docker tag smarkets/marge-bot:$$(cat version) smarkets/marge-bot:stable; \
docker push smarkets/marge-bot:stable; \
fi
docker push smarkets/marge-bot:$(VERSION)
docker push smarkets/marge-bot:latest
# for backwards compatibility push to previous location
docker tag smarkets/marge-bot:latest smarketshq/marge-bot:latest
docker tag smarkets/marge-bot:latest smarketshq/marge-bot:$$(cat version)
docker push smarketshq/marge-bot:$$(cat version)
docker tag smarkets/marge-bot:latest smarketshq/marge-bot:$(VERSION)
docker push smarketshq/marge-bot:$(VERSION)
docker push smarketshq/marge-bot:latest
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,19 @@ ssh-key: |
```bash
docker run --restart=on-failure \
-v "$(pwd)":/configuration \
smarkets/marge-bot \
smarkets/marge-bot:stable \
--config-file=/configuration/marge-bot-config.yaml
```

Note the use of the stable tag, which will use the latest released version.
Without this, by default docker will use the `latest` tag, which corresponds to
the HEAD commit of the `master` branch. Feel free to use this instead (or the
`master` tag, to be more precise) if you want the latest updates, at the risk
of possible bugs.

You can also specify a particular version as a tag, e.g.
`smarkets/marge-bot:0.7.0`.

### Running marge-bot in kubernetes
It's also possible to run marge in kubernetes, e.g. here's how you use a ktmpl
template:
Expand Down