Browse Source

Updating Docker Gate use of zuul.newrev

- Zuul updated ansible to 2.7, no longer allows missing variables.
- Using default value when it isn't available.
- airship_deckhand_path isn't working, but is a non-voting gate.

Based on Aaron Sheffield's PS for Pegleg: https://review.openstack.org/#/c/645631/

Change-Id: I6fe13d2043480cd6de6785203373f35d83545196
Aaron Sheffield 4 weeks ago
parent
commit
7685456ef2

+ 2
- 2
tools/gate/playbooks/docker-image-build.yaml View File

@@ -30,7 +30,7 @@
30 30
       environment:
31 31
         BRANCH: "{{ zuul.branch }}"
32 32
         CHANGE: "{{ zuul.change }}"
33
-        COMMIT: "{{ zuul.newrev }}"
33
+        COMMIT: "{{ zuul.newrev | default('') }}"
34 34
         PATCHSET: "{{ zuul.patchset }}"
35 35
       register: image_tags
36 36
 
@@ -83,7 +83,7 @@
83 83
               DOCKER_REGISTRY: "quay.io"
84 84
               IMAGE_PREFIX: "airshipit"
85 85
               IMAGE_TAG: "{{ item }}"
86
-              COMMIT: "{{ zuul.newrev }}"
86
+              COMMIT: "{{ zuul.newrev | default('') }}"
87 87
               PUSH_IMAGE: "true"
88 88
           with_items: "{{ image_tags.stdout_lines }}"
89 89
 

+ 1
- 1
tools/gate/playbooks/docker-image-tag.yaml View File

@@ -18,7 +18,7 @@
18 18
     latest_tag: latest
19 19
     org: airshipit
20 20
     image: deckhand
21
-    new_tag: "{{ zuul.newrev }}"
21
+    new_tag: "{{ zuul.newrev | default('') }}"
22 22
     token: "{{ airship_deckhand_quay_creds.token }}"
23 23
     quay_repo_api_url: "https://quay.io/api/v1/repository"
24 24
   tasks:

+ 1
- 1
tools/gate/roles/build-images/tasks/build-airship-deckhand-image.yaml View File

@@ -27,7 +27,7 @@
27 27
       shell: cd "{{ work_dir }}"; pwd
28 28
       register: airship_deckhand_path
29 29
       vars:
30
-        work_dir: "{{ zuul.project.src_dir }}/{{ zuul_airship_deckhand_relative_path | default('') }}"
30
+        work_dir: "{{ zuul.project.src_dir | default('') }}/{{ zuul_airship_deckhand_relative_path | default('') }}"
31 31
 
32 32
     - name: Build Airship-Deckhand Image
33 33
       when: proxy.http is undefined or (proxy.http | trim == "")

+ 2
- 2
tools/gate/roles/deploy-deckhand/tasks/deploy-deckhand.yaml View File

@@ -20,7 +20,7 @@
20 20
     docker run \
21 21
       --rm \
22 22
       --net=host \
23
-      -v "{{ deckhand_conf_dir }}":/etc/deckhand "{{ airship_deckhand_image_id.stdout }}" alembic upgrade head
23
+      -v "{{ deckhand_conf_dir | default('') }}":/etc/deckhand "{{ airship_deckhand_image_id.stdout }}" alembic upgrade head
24 24
 
25 25
     # Allow migrations to complete.
26 26
     sleep 10
@@ -32,7 +32,7 @@
32 32
       --rm \
33 33
       --net=host \
34 34
       -p 9000:9000 \
35
-      -v "{{ deckhand_conf_dir }}":/etc/deckhand "{{ airship_deckhand_image_id.stdout }}" server &
35
+      -v "{{ deckhand_conf_dir | default('') }}":/etc/deckhand "{{ airship_deckhand_image_id.stdout }}" server &
36 36
 
37 37
     # Give the server a chance to come up. Better to poll a health check.
38 38
     sleep 10

+ 2
- 2
tools/gate/roles/deploy-postgresql/tasks/deploy-postgresql.yaml View File

@@ -17,7 +17,7 @@
17 17
         set -e;
18 18
         ./tools/gate/scripts/020-deploy-postgresql.sh
19 19
   args:
20
-    chdir: "{{ zuul.project.src_dir }}"
20
+    chdir: "{{ zuul.project.src_dir | default('') }}"
21 21
   register: _airship_deckhand_database_url
22 22
   become: yes
23 23
 
@@ -25,4 +25,4 @@
25 25
   set_fact:
26 26
     airship_deckhand_database_url: "{{ _airship_deckhand_database_url.stdout_lines | last }}"
27 27
   environment:
28
-    AIRSHIP_DECKHAND_DATABASE_URL: "{{ airship_deckhand_database_url }}"
28
+    AIRSHIP_DECKHAND_DATABASE_URL: "{{ airship_deckhand_database_url | default('') }}"

+ 12
- 12
tools/gate/roles/generate-test-config/tasks/generate-test-config.yaml View File

@@ -20,20 +20,20 @@
20 20
 
21 21
 - name: Store deckhand_conf_dir in variable
22 22
   set_fact:
23
-    deckhand_conf_dir: "{{ _deckhand_conf_dir.path }}"
23
+    deckhand_conf_dir: "{{ _deckhand_conf_dir.path | default('') }}"
24 24
   environment:
25 25
     # Used by Deckhand's initialization script to search for config files.
26
-    AIRSHIP_DECKHAND_CONFIG_DIR: "{{ deckhand_conf_dir }}"
26
+    AIRSHIP_DECKHAND_CONFIG_DIR: "{{ deckhand_conf_dir | default('') }}"
27 27
 
28 28
 - name: Generate test deckhand.conf file when disable_keystone is true
29 29
   when: disable_keystone == true
30 30
   shell: |-
31 31
     set -ex;
32 32
 
33
-    chmod 777 -R "{{ deckhand_conf_dir }}"
34
-    conf_file="{{ deckhand_conf_dir }}"/deckhand.conf
33
+    chmod 777 -R "{{ deckhand_conf_dir  | default('')}}"
34
+    conf_file="{{ deckhand_conf_dir | default('') }}"/deckhand.conf
35 35
 
36
-    cp etc/deckhand/logging.conf.sample "{{ deckhand_conf_dir }}"/logging.conf
36
+    cp etc/deckhand/logging.conf.sample "{{ deckhand_conf_dir | default('') }}"/logging.conf
37 37
     envsubst '$AIRSHIP_DECKHAND_DATABASE_URL' < deckhand/tests/deckhand.conf.test > $conf_file
38 38
 
39 39
     echo "Toggling development_mode on to disable Keystone authentication."
@@ -42,8 +42,8 @@
42 42
     echo $conf_file 1>&2
43 43
     cat $conf_file 1>&2
44 44
 
45
-    echo "{{ deckhand_conf_dir }}"/logging.conf 1>&2
46
-    cat "{{ deckhand_conf_dir }}"/logging.conf 1>&2
45
+    echo "{{ deckhand_conf_dir | default('') }}"/logging.conf 1>&2
46
+    cat "{{ deckhand_conf_dir | default('') }}"/logging.conf 1>&2
47 47
   args:
48 48
     chdir: "{{ airship_deckhand_path.stdout }}"
49 49
   environment:
@@ -55,17 +55,17 @@
55 55
   shell: |-
56 56
     set -ex;
57 57
 
58
-    chmod 777 -R "{{ deckhand_conf_dir }}"
59
-    conf_file="{{ deckhand_conf_dir }}"/deckhand.conf
58
+    chmod 777 -R "{{ deckhand_conf_dir | default('') }}"
59
+    conf_file="{{ deckhand_conf_dir | default('') }}"/deckhand.conf
60 60
 
61
-    cp etc/deckhand/logging.conf.sample "{{ deckhand_conf_dir }}"/logging.conf
61
+    cp etc/deckhand/logging.conf.sample "{{ deckhand_conf_dir | default('') }}"/logging.conf
62 62
     envsubst '$AIRSHIP_DECKHAND_DATABASE_URL $TEST_BARBICAN_URL' < deckhand/tests/deckhand.conf.test > $conf_file
63 63
 
64 64
     echo $conf_file 1>&2
65 65
     cat $conf_file 1>&2
66 66
 
67
-    echo "{{ deckhand_conf_dir }}"/logging.conf 1>&2
68
-    cat "{{ deckhand_conf_dir }}"/logging.conf 1>&2
67
+    echo "{{ deckhand_conf_dir | default('') }}"/logging.conf 1>&2
68
+    cat "{{ deckhand_conf_dir | default('') }}"/logging.conf 1>&2
69 69
   args:
70 70
     chdir: "{{ airship_deckhand_path.stdout }}"
71 71
   environment:

+ 2
- 2
tools/gate/roles/generate-test-config/tasks/generate-test-paste.yaml View File

@@ -17,7 +17,7 @@
17 17
   shell: |-
18 18
     set -ex;
19 19
     echo "Using noauth-paste.ini to disable Keystone authentication."
20
-    cp etc/deckhand/noauth-paste.ini "{{ deckhand_conf_dir }}"/noauth-paste.ini
20
+    cp etc/deckhand/noauth-paste.ini "{{ deckhand_conf_dir | default('') }}"/noauth-paste.ini
21 21
   args:
22 22
     chdir: "{{ airship_deckhand_path.stdout }}"
23 23
 
@@ -25,6 +25,6 @@
25 25
   when: disable_keystone == false
26 26
   shell: |-
27 27
     set -ex;
28
-    cp etc/deckhand/deckhand-paste.ini "{{ deckhand_conf_dir }}"/deckhand-paste.ini
28
+    cp etc/deckhand/deckhand-paste.ini "{{ deckhand_conf_dir | default('') }}"/deckhand-paste.ini
29 29
   args:
30 30
     chdir: "{{ airship_deckhand_path.stdout }}"

Loading…
Cancel
Save