Commit c6acd3e4 authored by Victor Nikulshin's avatar Victor Nikulshin
Browse files

Merge branch 'feature/docker.clean' into '2.x'

Feature/docker.clean

Removes container and images for a fresh workspace

See merge request !24
parents f8fee175 19d47c0d
Pipeline #1342 passed with stages
in 51 seconds
...@@ -9,11 +9,11 @@ health-check: ...@@ -9,11 +9,11 @@ health-check:
- fab --version - fab --version
- fab -f . --list-format=nested --list - fab -f . --list-format=nested --list
tags: tags:
- docker-images - docker-generic
sonarqube: sonarqube:
image: ntdt/sonar-scanner:2.7 image: ntdt/sonar-scanner:2.7
stage: quality stage: quality
script: script:
- cd $CI_PROJECT_DIR && /opt/sonar-scanner/bin/sonar-scanner -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN - cd $CI_PROJECT_DIR && /opt/sonar-scanner/bin/sonar-scanner -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN
tags: tags:
- docker-images - docker-generic
...@@ -16,6 +16,7 @@ This project adheres to http://semver.org/[Semantic Versioning]. ...@@ -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 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 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 == 2.0.0 - 2016/05/09
......
...@@ -2,6 +2,7 @@ from __future__ import unicode_literals ...@@ -2,6 +2,7 @@ from __future__ import unicode_literals
from fabric.api import task, roles, env, local, run, lcd from fabric.api import task, roles, env, local, run, lcd
from fabric.colors import red, green from fabric.colors import red, green
from fabric.contrib.console import confirm
import helpers as h import helpers as h
...@@ -220,6 +221,21 @@ def image_remove(): ...@@ -220,6 +221,21 @@ def image_remove():
print(red('Docker image {}/drupal was not found'.format(env.project_name))) print(red('Docker image {}/drupal was not found'.format(env.project_name)))
@task
@roles('local')
def clean():
"""
Clean docker workspace (removes container & images)
"""
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 @task
@roles('docker') @roles('docker')
def update_host(): def update_host():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment