[ARVADOS-DEV] updated: 7654059fbbaf6f9e1ac6f032b087a8768debfeb5

Git user git at public.curoverse.com
Tue Oct 18 12:54:53 EDT 2016


Summary of changes:
 jenkins/install-arvados-jobs-image | 108 +++++++++++++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)
 create mode 100755 jenkins/install-arvados-jobs-image

       via  7654059fbbaf6f9e1ac6f032b087a8768debfeb5 (commit)
      from  b29bc5199ff7fe908420cd1c718be095d1ee58c4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7654059fbbaf6f9e1ac6f032b087a8768debfeb5
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Oct 18 12:54:24 2016 -0400

    Add install-arvados-jobs-image script. No issue #

diff --git a/jenkins/install-arvados-jobs-image b/jenkins/install-arvados-jobs-image
new file mode 100755
index 0000000..d825f7f
--- /dev/null
+++ b/jenkins/install-arvados-jobs-image
@@ -0,0 +1,108 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import argparse
+import arvados
+import logging
+import subprocess
+
+
+def uuid_prefix(arv):
+    return arv.users().current().execute()['uuid'][:5]
+
+
+def findormake_project(arv, prefix, project_name):
+    system_user_uuid = prefix+'-tpzed-000000000000000'
+    groups = arv.groups().list(
+        filters=[
+            ['group_class', '=', 'project'],
+            ['name', '=', project_name],
+            ['owner_uuid', '=', system_user_uuid],
+        ],
+        select=['uuid']).execute()['items']
+    if groups:
+        uuid = groups[0]['uuid']
+        logger.debug('found project %s', uuid)
+        return uuid
+    uuid = arv.groups().create(body={
+        group_class: 'project',
+        name: project_name,
+        owner_uuid: system_user_uuid,
+    }).execute()['uuid']
+    logger.info('created project %s: %s', uuid, project_name)
+    return uuid
+
+
+def findormake_project_perm(arv, prefix, project_uuid):
+    all_users_group_uuid = prefix+'-j7d0g-fffffffffffffff'
+    if arv.links().list(
+            filters=[
+                ['tail_uuid', '=', all_users_group_uuid],
+                ['head_uuid', '=', project_uuid],
+                ['link_class', '=', 'permission'],
+                ['name', '=', 'can_read'],
+            ],
+            select=['uuid']).execute()['items']:
+        logger.debug('found permission link %s', uuid)
+        return
+    uuid = arv.links().create(body={
+        'tail_uuid': all_users_group_uuid,
+        'head_uuid': project_uuid,
+        'link_class': 'permission',
+        'name': 'can_read',
+    }).execute()['uuid']
+    logger.info('created permission link %s: %s -> %s',
+                uuid, all_users_group_uuid, project_uuid)
+    return uuid
+
+
+def findorpull_image(want_repo, want_tag, project_uuid):
+    for line in subprocess.check_output(['arv-keepdocker']).splitlines():
+        try:
+            repo, tag, image_id, collection, created = line.split(None, 4)
+        except ValueError:
+            continue
+        if repo == want_repo and tag == want_tag:
+            logger.debug('found image tag %s collection %s created %s',
+                        tag, collection, created)
+            return collection
+    logger.info('pulling repo %s tag %s', want_repo, want_tag)
+    subprocess.check_call([
+        'arv-keepdocker',
+        '--pull', '--project-uuid='+project_uuid,
+        want_repo, want_tag])
+
+
+def tag_latest(repo, tag, project_uuid):
+    logger.debug('tagging %s:%s as %s:latest', repo, tag, repo)
+    subprocess.check_call([
+        'docker', 'tag', '-f', repo+':'+tag, repo+':latest'])
+    logger.debug('arv-keepdocker %s:latest', repo, tag, repo)
+    subprocess.check_call([
+        'arv-keepdocker',
+        '--project-uuid='+project_uuid,
+        repo, 'latest'])
+
+
+logging.basicConfig()
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.INFO)
+
+parser = argparse.ArgumentParser(
+    description='Pull a specific version of the arvados/jobs image to Keep, and tag it as :latest')
+parser.add_argument(
+    '--git-commit', type=str, required=True,
+    help='git commit hash of desired version')
+parser.add_argument(
+    '--verbose', '-v', action='count', default=0,
+    help='print more debug messages')
+args = parser.parse_args()
+logger.setLevel(logging.INFO - 10 * args.verbose)
+
+arv = arvados.api('v1')
+prefix = uuid_prefix(arv)
+project_uuid = findormake_project(arv, prefix, 'Arvados Standard Docker Images')
+findormake_project_perm(arv, prefix, project_uuid)
+findorpull_image('arvados/jobs', args.git_commit, project_uuid)
+tag_latest('arvados/jobs', args.git_commit, project_uuid)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list