diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d62f174..0920f6dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,35 @@ # Change Log -## [1.2.1](https://github.com/pyouroboros/ouroboros/tree/1.2.1) (2019-02-13) +## [1.3.0](https://github.com/pyouroboros/ouroboros/tree/1.3.0) (2019-02-25) +[Full Changelog](https://github.com/pyouroboros/ouroboros/compare/1.2.1...1.3.0) + +**Implemented enhancements:** + +- Start new container in detached mode [\#222](https://github.com/pyouroboros/ouroboros/pull/222) ([nightvisi0n](https://github.com/nightvisi0n)) +- Optimise dockerfile layers [\#218](https://github.com/pyouroboros/ouroboros/pull/218) ([nightvisi0n](https://github.com/nightvisi0n)) + +**Fixed bugs:** + +- Catch Failed self-updates [\#230](https://github.com/pyouroboros/ouroboros/issues/230) +- Cron scheduled missed following successful runs [\#229](https://github.com/pyouroboros/ouroboros/issues/229) +- Catch attribute.id error [\#226](https://github.com/pyouroboros/ouroboros/issues/226) +- AttachStdout and AttachStderr are not carried over properly [\#221](https://github.com/pyouroboros/ouroboros/issues/221) +- Exception when updating container started with --rm \(autoremove\) [\#219](https://github.com/pyouroboros/ouroboros/issues/219) +- Issue with Swarm Mode V2 [\#216](https://github.com/pyouroboros/ouroboros/issues/216) +- Fix docker swarm mode [\#227](https://github.com/pyouroboros/ouroboros/pull/227) ([mathcantin](https://github.com/mathcantin)) + +**Other Pull Requests** + +- v1.3.0 Merge [\#241](https://github.com/pyouroboros/ouroboros/pull/241) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) +- v1.3.0 to develop [\#240](https://github.com/pyouroboros/ouroboros/pull/240) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) +- Catch self update apierror [\#238](https://github.com/pyouroboros/ouroboros/pull/238) ([circa10a](https://github.com/circa10a)) +- Catch attribute error [\#237](https://github.com/pyouroboros/ouroboros/pull/237) ([circa10a](https://github.com/circa10a)) +- Check for autoremove [\#236](https://github.com/pyouroboros/ouroboros/pull/236) ([circa10a](https://github.com/circa10a)) +- Add misfire\_grace\_time for cron scheduler [\#234](https://github.com/pyouroboros/ouroboros/pull/234) ([circa10a](https://github.com/circa10a)) +- Check all services by default on swarm mode [\#228](https://github.com/pyouroboros/ouroboros/pull/228) [[cleanup](https://github.com/pyouroboros/ouroboros/labels/cleanup)] ([mathcantin](https://github.com/mathcantin)) +- remove git in pypi + branch develop + version bump + maintainer\_email [\#214](https://github.com/pyouroboros/ouroboros/pull/214) ([DirtyCajunRice](https://github.com/DirtyCajunRice)) + +## [1.2.1](https://github.com/pyouroboros/ouroboros/tree/1.2.1) (2019-02-14) [Full Changelog](https://github.com/pyouroboros/ouroboros/compare/1.2.0...1.2.1) **Fixed bugs:** diff --git a/Dockerfile b/Dockerfile index 4ace0a2f..a5fce1ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM amd64/python:3.7.2-alpine -LABEL maintainers="dirtycajunrice,circa10a,tkdeviant" +LABEL maintainers="dirtycajunrice,circa10a" ENV TZ UTC diff --git a/Dockerfile.arm b/Dockerfile.arm index 1c21faaf..f027b096 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -1,6 +1,6 @@ FROM arm32v6/python:3.7.2-alpine -LABEL maintainers="dirtycajunrice,circa10a,tkdeviant" +LABEL maintainers="dirtycajunrice,circa10a" ENV TZ UTC diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index da879bac..dd3bd512 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -1,6 +1,6 @@ FROM arm64v8/python:3.7.2-alpine -LABEL maintainers="dirtycajunrice,circa10a,tkdeviant" +LABEL maintainers="dirtycajunrice,circa10a" ENV TZ UTC diff --git a/README.md b/README.md index f30f4ef2..928ebfee 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ [![BuyUsCoffee](https://img.shields.io/badge/BuyMeACoffee-Donate-ff813f.svg?logo=CoffeeScript&style=flat-square)](https://buymeacoff.ee/ouroboros) [![Build Status](https://jenkins.cajun.pro/buildStatus/icon?job=Ouroboros/master)](https://jenkins.cajun.pro/job/Ouroboros/job/master/) [![Release](https://img.shields.io/github/release/pyouroboros/ouroboros.svg?style=flat-square)](https://hub.docker.com/r/pyouroboros/ouroboros/) -[![Pypi Downloads](https://img.shields.io/pypi/dm/ouroboros-cli.svg?style=flat-square)](https://pypi.org/project/ouroboros-cli/) [![Python Version](https://img.shields.io/pypi/pyversions/ouroboros-cli.svg?style=flat-square)](https://pypi.org/project/ouroboros-cli/) [![Docker Pulls](https://img.shields.io/docker/pulls/pyouroboros/ouroboros.svg?style=flat-square)](https://hub.docker.com/r/pyouroboros/ouroboros/) [![Layers](https://images.microbadger.com/badges/image/pyouroboros/ouroboros.svg)](https://microbadger.com/images/pyouroboros/ouroboros) diff --git a/pyouroboros/__init__.py b/pyouroboros/__init__.py index e8daf2fe..6a92b727 100644 --- a/pyouroboros/__init__.py +++ b/pyouroboros/__init__.py @@ -1,2 +1,2 @@ -VERSION = "1.2.2" -BRANCH = "develop" +VERSION = "1.3.0" +BRANCH = "master" diff --git a/pyouroboros/dockerclient.py b/pyouroboros/dockerclient.py index 80731f91..9385f84e 100644 --- a/pyouroboros/dockerclient.py +++ b/pyouroboros/dockerclient.py @@ -4,7 +4,7 @@ from os.path import isdir, isfile, join from docker.errors import DockerException, APIError, NotFound -from pyouroboros.helpers import set_properties +from pyouroboros.helpers import set_properties, remove_sha_prefix, get_digest class Docker(object): @@ -66,8 +66,6 @@ def __init__(self, docker_client): self.data_manager.total_updated[self.socket] = 0 self.notification_manager = self.docker.notification_manager - self.monitored = self.monitor_filter() - def _pull(self, tag): """Docker pull image tag""" self.logger.debug('Checking tag: %s', tag) @@ -77,7 +75,7 @@ def _pull(self, tag): "username"), self.config.auth_json.get("password")) if self.config.dry_run: - # The authentification doesn't work with this call + # The authentication doesn't work with this call # See bugs https://github.com/docker/docker-py/issues/2225 return self.client.images.get_registry_data(tag) else: @@ -106,6 +104,7 @@ def _pull(self, tag): class Container(BaseImageObject): def __init__(self, docker_client): super().__init__(docker_client) + self.monitored = self.monitor_filter() # Container sub functions def stop(self, container): @@ -375,6 +374,7 @@ def update_self(self, count=None, old_container=None, me_list=None, new_image=No class Service(BaseImageObject): def __init__(self, docker_client): super().__init__(docker_client) + self.monitored = self.monitor_filter() def monitor_filter(self): """Return filtered service objects list""" @@ -396,20 +396,6 @@ def pull(self, tag): """Docker pull image tag""" return self._pull(tag) - def _remove_sha_prefix(self, digest): - if digest.startswith("sha256:"): - return digest[7:] - return digest - - def _get_digest(self, image): - digest = image.attrs.get( - "Descriptor", {} - ).get("digest") or image.attrs.get( - "RepoDigests" - )[0].split('@')[1] or image.id - - return self._remove_sha_prefix(digest) - def update(self): updated_service_tuples = [] self.monitored = self.monitor_filter() @@ -421,7 +407,7 @@ def update(self): image_string = service.attrs['Spec']['TaskTemplate']['ContainerSpec']['Image'] if '@' in image_string: tag = image_string.split('@')[0] - sha256 = self._remove_sha_prefix(image_string.split('@')[1]) + sha256 = remove_sha_prefix(image_string.split('@')[1]) else: self.logger.error('No image SHA for %s. Skipping', image_string) continue @@ -431,7 +417,7 @@ def update(self): except ConnectionError: continue - latest_image_sha256 = self._get_digest(latest_image) + latest_image_sha256 = get_digest(latest_image) self.logger.debug('Latest sha256 for %s is %s', tag, latest_image_sha256) if sha256 != latest_image_sha256: diff --git a/pyouroboros/helpers.py b/pyouroboros/helpers.py index 40a254ec..54125051 100644 --- a/pyouroboros/helpers.py +++ b/pyouroboros/helpers.py @@ -23,3 +23,18 @@ def set_properties(old, new, self_name=None): } return properties + + +def remove_sha_prefix(digest): + if digest.startswith("sha256:"): + return digest[7:] + return digest + + +def get_digest(image): + digest = image.attrs.get( + "Descriptor", {} + ).get("digest") or image.attrs.get( + "RepoDigests" + )[0].split('@')[1] or image.id + return remove_sha_prefix(digest)