[MediaWiki-commits] [Gerrit] integration/config[master]: New fab task for rebuilding docker-pkg images

2017-12-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391592 )

Change subject: New fab task for rebuilding docker-pkg images
..


New fab task for rebuilding docker-pkg images

Automates the task of updating integration/config on contint1001 and
rebuilding the docker-pkg dockerfiles there.

Change-Id: I993080dd9e2153cea766aeecc1decfab36d8767b
---
M fabfile.py
1 file changed, 47 insertions(+), 13 deletions(-)

Approvals:
  Thcipriani: Looks good to me, approved
  Hashar: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/fabfile.py b/fabfile.py
index 271a4d6..2307854 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -19,24 +19,58 @@
 env.use_ssh_config = True
 
 
+def _update_integration_config(
+diff_dir='zuul', log_msg='Reloading Zuul to deploy [hash]'):
+env.sudo_user = 'zuul'
+with cd('/etc/zuul/wikimedia'):
+sudo('git remote update')
+sudo('git --no-pager log -p HEAD..origin/master {}'.format(diff_dir))
+if confirm('Does the diff look good?') and confirm(
+'Did you log your reload in #wikimedia-releng (e.g. ' +
+'"!log {}")'.format(log_msg)):
+sudo('git rebase')
+sudo('git -c gc.auto=128 gc --auto --quiet')
+
+return True
+
+return False
+
+
+@task
+def deploy_docker():
+"""Update docker-pkg built images"""
+env.host_string = 'contint1001.wikimedia.org'
+
+updated = _update_integration_config(
+diff_dir='dockerfiles',
+log_msg='Updating docker-pkg files on contint1001 for [hash]'
+)
+
+if not updated:
+return
+
+with cd('/tmp'):
+env.sudo_user = 'jenkins-slave'
+
+docker_pkg = '/srv/deployment/docker-pkg/venv/bin/docker-pkg'
+docker_pkg_config = '/etc/docker-pkg/integration.yaml'
+dockerfiles = '/etc/zuul/wikimedia/dockerfiles'
+cmd = '{} -c {} {}'.format(docker_pkg, docker_pkg_config, dockerfiles)
+
+sudo(cmd)
+
+sudo('cat /tmp/docker-pkg-build.log')
+
+if confirm('delete build log?'):
+sudo('rm /tmp/docker-pkg-build.log')
+
+
 @task
 def deploy_zuul():
 """Deploy a Zuul layout change"""
-env.sudo_user = 'zuul'
 env.host_string = 'contint1001.wikimedia.org'
 
-do_reload = False
-with cd('/etc/zuul/wikimedia'):
-sudo('git remote update')
-sudo('git --no-pager log -p HEAD..origin/master zuul')
-if confirm('Does the diff look good?') and confirm(
-'Did you log your reload in #wikimedia-releng (e.g. ' +
-'"!log Reloading Zuul to deploy [hash]")'):
-sudo('git rebase')
-sudo('git -c gc.auto=128 gc --auto --quiet')
-do_reload = True
-
-if do_reload:
+if _update_integration_config():
 env.sudo_user = 'root'
 sudo('/usr/sbin/service zuul reload', shell=False)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/391592
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I993080dd9e2153cea766aeecc1decfab36d8767b
Gerrit-PatchSet: 2
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Thcipriani 
Gerrit-Reviewer: Hashar 
Gerrit-Reviewer: Paladox 
Gerrit-Reviewer: Thcipriani 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] integration/config[master]: New fab task for rebuilding docker-pkg images

2017-11-15 Thread Thcipriani (Code Review)
Thcipriani has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391592 )

Change subject: New fab task for rebuilding docker-pkg images
..

New fab task for rebuilding docker-pkg images

Automates the task of updating integration/config on contint1001 and
rebuilding the docker-pkg dockerfiles there.

Change-Id: I993080dd9e2153cea766aeecc1decfab36d8767b
---
M fabfile.py
1 file changed, 47 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/92/391592/1

diff --git a/fabfile.py b/fabfile.py
index 271a4d6..2307854 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -19,24 +19,58 @@
 env.use_ssh_config = True
 
 
+def _update_integration_config(
+diff_dir='zuul', log_msg='Reloading Zuul to deploy [hash]'):
+env.sudo_user = 'zuul'
+with cd('/etc/zuul/wikimedia'):
+sudo('git remote update')
+sudo('git --no-pager log -p HEAD..origin/master {}'.format(diff_dir))
+if confirm('Does the diff look good?') and confirm(
+'Did you log your reload in #wikimedia-releng (e.g. ' +
+'"!log {}")'.format(log_msg)):
+sudo('git rebase')
+sudo('git -c gc.auto=128 gc --auto --quiet')
+
+return True
+
+return False
+
+
+@task
+def deploy_docker():
+"""Update docker-pkg built images"""
+env.host_string = 'contint1001.wikimedia.org'
+
+updated = _update_integration_config(
+diff_dir='dockerfiles',
+log_msg='Updating docker-pkg files on contint1001 for [hash]'
+)
+
+if not updated:
+return
+
+with cd('/tmp'):
+env.sudo_user = 'jenkins-slave'
+
+docker_pkg = '/srv/deployment/docker-pkg/venv/bin/docker-pkg'
+docker_pkg_config = '/etc/docker-pkg/integration.yaml'
+dockerfiles = '/etc/zuul/wikimedia/dockerfiles'
+cmd = '{} -c {} {}'.format(docker_pkg, docker_pkg_config, dockerfiles)
+
+sudo(cmd)
+
+sudo('cat /tmp/docker-pkg-build.log')
+
+if confirm('delete build log?'):
+sudo('rm /tmp/docker-pkg-build.log')
+
+
 @task
 def deploy_zuul():
 """Deploy a Zuul layout change"""
-env.sudo_user = 'zuul'
 env.host_string = 'contint1001.wikimedia.org'
 
-do_reload = False
-with cd('/etc/zuul/wikimedia'):
-sudo('git remote update')
-sudo('git --no-pager log -p HEAD..origin/master zuul')
-if confirm('Does the diff look good?') and confirm(
-'Did you log your reload in #wikimedia-releng (e.g. ' +
-'"!log Reloading Zuul to deploy [hash]")'):
-sudo('git rebase')
-sudo('git -c gc.auto=128 gc --auto --quiet')
-do_reload = True
-
-if do_reload:
+if _update_integration_config():
 env.sudo_user = 'root'
 sudo('/usr/sbin/service zuul reload', shell=False)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/391592
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I993080dd9e2153cea766aeecc1decfab36d8767b
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: Thcipriani 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits