From 722a8c887b116cb4d4000f50279a92e1de1cde8b Mon Sep 17 00:00:00 2001 From: Samuel Sirois Date: Mon, 7 Nov 2016 11:29:07 -0500 Subject: [PATCH 1/3] Add docker.clean command --- docker.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docker.py b/docker.py index afaec57..f458c1f 100644 --- a/docker.py +++ b/docker.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from fabric.api import task, roles, env, local, run, lcd from fabric.colors import red, green +from fabric.contrib.console import confirm import helpers as h @@ -220,6 +221,21 @@ def image_remove(): print(red('Docker image {}/drupal was not found'.format(env.project_name))) +@task +@roles('local') +def clean(): + """ + Clean docker workspace + """ + if (confirm( + red('This will stop, remove container and delete docker image ' + + 'related to this project. Do you want to continue?'), + default=False)): + container_stop() + container_remove() + image_remove() + + @task @roles('docker') def update_host(): -- GitLab From 3ee7da9f1470821f5f8d389ab0f6601dad2d3cf1 Mon Sep 17 00:00:00 2001 From: Samuel Sirois Date: Mon, 7 Nov 2016 11:32:00 -0500 Subject: [PATCH 2/3] Document new docker.clean command --- CHANGELOG.adoc | 1 + docker.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 6014304..9b16814 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -16,6 +16,7 @@ This project adheres to http://semver.org/[Semantic Versioning]. * Add a Patternlab command to build the static style guide: `fab patternlab.build`. * Add a Git command to verify repositories states and warn user if changes might be lost. +* Add a docker.clean command to clean docker's workspace (removes container and image). == 2.0.0 - 2016/05/09 diff --git a/docker.py b/docker.py index f458c1f..f972d1e 100644 --- a/docker.py +++ b/docker.py @@ -225,7 +225,7 @@ def image_remove(): @roles('local') def clean(): """ - Clean docker workspace + Clean docker workspace (removes container & images) """ if (confirm( red('This will stop, remove container and delete docker image ' + -- GitLab From 19d47c0d9445f2674ebc0914a71ef3fca22da065 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou Date: Mon, 7 Nov 2016 11:51:09 -0500 Subject: [PATCH 3/3] Use docker-generic tagged executors --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 73e67ef..09869ac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,11 +9,11 @@ health-check: - fab --version - fab -f . --list-format=nested --list tags: - - docker-images + - docker-generic sonarqube: image: ntdt/sonar-scanner:2.7 stage: quality script: - cd $CI_PROJECT_DIR && /opt/sonar-scanner/bin/sonar-scanner -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN tags: - - docker-images + - docker-generic -- GitLab