Browse Source

Update buildimage playbook for zuul v3

Rather than continue using a venv, let's update the job to zuul v3 and
use the native system to perform the image building.

Change-Id: I2a7a60cf3f81102ffbb95187f7419e4c804be689
changes/02/610102/24
Alex Schultz 8 months ago
parent
commit
c68220e8e8

+ 83
- 0
playbooks/tripleo-buildimage/run-v3.yaml View File

@@ -0,0 +1,83 @@
1
+- hosts: all
2
+  name: TripleO image building job
3
+  roles:
4
+    - role: bindep
5
+      bindep_dir: "{{ ansible_user_dir }}/{{ zuul.projects['git.openstack.org/openstack/python-tripleoclient'].src_dir }}"
6
+    - role: tripleo-repos
7
+      tripleo_repos_repository: "{{ ansible_user_dir }}/{{ zuul.projects['git.openstack.org/openstack/tripleo-repos'].src_dir }}"
8
+  tasks:
9
+    - name: Include common buildimage vars
10
+      include_vars:
11
+        file: "common.yaml"
12
+
13
+    - name: Swap is essential as we are not meeting memory requirements
14
+      include_role:
15
+        name: configure-swap
16
+
17
+    - name: Set legacy log path
18
+      include_role:
19
+        name: set-zuul-log-path-fact
20
+
21
+    - name: Ensure legacy workspace directory
22
+      file:
23
+        path: '{{ workspace }}'
24
+        state: directory
25
+
26
+    - name: Ensure legacy logs directory
27
+      file:
28
+        path: '{{ workspace }}/logs'
29
+        state: directory
30
+
31
+    - name: Install pip
32
+      package:
33
+        name: python-pip
34
+        state: present
35
+
36
+    - name: Install virtualenv
37
+      package:
38
+        name: python-virtualenv
39
+        state: present
40
+
41
+    - name: pip install tripleo items
42
+      become: true
43
+      pip:
44
+        name:
45
+          - "file://{{ openstack_git_root }}/diskimage-builder"
46
+          - "file://{{ openstack_git_root }}/python-tripleoclient"
47
+          - "file://{{ openstack_git_root }}/tripleo-common"
48
+        state: present
49
+        virtualenv: "{{ workspace }}/venv"
50
+
51
+    # NOTE(aschultz) :we dropped support for instack-undercloud in Stein so
52
+    # we use a directory existance check to determine if we should include it
53
+    - name: Run image build
54
+      args:
55
+        chdir: '{{ workspace }}'
56
+      shell: |
57
+        set -x
58
+        source {{ workspace }}/venv/bin/activate
59
+        TRIPLEO_COMMON_PATH="{{ openstack_git_root }}/tripleo-common"
60
+
61
+        ELEMENTS="{{ openstack_git_root }}/tripleo-puppet-elements/elements:"
62
+        ELEMENTS+="{{ openstack_git_root }}/tripleo-image-elements/elements:"
63
+        ELEMENTS+="{{ openstack_git_root }}/heat-templates/hot/software-config/elements"
64
+
65
+        if [ -d "{{ openstack_git_root }}/instack-undercloud/elements" ]; then
66
+          ELEMENTS="{{ openstack_git_root }}/instack-undercloud/elements:${ELEMENTS}"
67
+        fi
68
+
69
+        if [ "{{ tripleo_image_type }}" == "overcloud-hardened-full" ]; then
70
+          CONFIG_FILES="--config-file $TRIPLEO_COMMON_PATH/image-yaml/overcloud-hardened-images.yaml --config-file $TRIPLEO_COMMON_PATH/image-yaml/overcloud-hardened-images-{{ tripleo_image_os }}.yaml"
71
+        else
72
+          CONFIG_FILES="--config-file $TRIPLEO_COMMON_PATH/image-yaml/overcloud-images.yaml --config-file $TRIPLEO_COMMON_PATH/image-yaml/overcloud-images-{{ tripleo_image_os }}.yaml"
73
+        fi
74
+
75
+        export ELEMENTS_PATH=$ELEMENTS
76
+        export DIB_YUM_REPO_CONF="/etc/yum.repos.d/delorean*"
77
+
78
+        openstack overcloud image build --image-name {{ tripleo_image_type }} $CONFIG_FILES > {{ workspace }}/build.log 2> {{ workspace }}/build-err.log
79
+        RESULT=$?
80
+
81
+        mv *.log {{ workspace }}/logs/
82
+        exit $RESULT
83
+

+ 5
- 3
playbooks/tripleo-buildimage/run.yaml View File

@@ -1,3 +1,4 @@
1
+### DEPRECATED USE run-v3.yaml
1 2
 - hosts: all
2 3
   name: Autoconverted job legacy-tripleo-buildimage
3 4
   roles:
@@ -49,6 +50,7 @@
49 50
           ELEMENTS="$WORKSPACE/tripleo-puppet-elements/elements:"
50 51
           ELEMENTS+="$WORKSPACE/tripleo-image-elements/elements:"
51 52
           ELEMENTS+="$WORKSPACE/heat-templates/hot/software-config/elements"
53
+          TOX_ENV=venv
52 54
 
53 55
           # Basic Deployment (CLI)
54 56
           # http://docs.openstack.org/developer/tripleo-docs/basic_deployment/basic_deployment_cli.html
@@ -91,7 +93,7 @@
91 93
           export DIB_YUM_REPO_CONF="/etc/yum.repos.d/delorean*"
92 94
 
93 95
           # install dib & tripleo-common source
94
-          tox -evenv -- pip install $WORKSPACE/diskimage-builder $WORKSPACE/tripleo-common
96
+          tox -- pip install $WORKSPACE/diskimage-builder $WORKSPACE/tripleo-common
95 97
 
96 98
           TRIPLEO_COMMON_PATH=$WORKSPACE/tripleo-common
97 99
           export ELEMENTS_PATH=$ELEMENTS
@@ -101,9 +103,9 @@
101 103
               CONFIG_FILES="--config-file $TRIPLEO_COMMON_PATH/image-yaml/overcloud-images.yaml --config-file $TRIPLEO_COMMON_PATH/image-yaml/overcloud-images-centos7.yaml"
102 104
           fi
103 105
           if [ "$ZUUL_BRANCH" == "stable/newton" ]; then
104
-              tox -evenv -- openstack overcloud image build --type {{ tripleo_image_type }} --elements-path="$ELEMENTS"
106
+              tox -- openstack overcloud image build --type {{ tripleo_image_type }} --elements-path="$ELEMENTS"
105 107
           else
106
-              tox -evenv -- openstack overcloud image build --image-name {{ tripleo_image_type }} $CONFIG_FILES
108
+              tox -- openstack overcloud image build --image-name {{ tripleo_image_type }} $CONFIG_FILES
107 109
           fi
108 110
 
109 111
           mkdir -p $WORKSPACE/logs

+ 2
- 0
playbooks/tripleo-buildimage/vars/common.yaml View File

@@ -0,0 +1,2 @@
1
+workspace: "{{ ansible_user_dir }}/workspace"
2
+openstack_git_root: "{{ ansible_user_dir }}/src/git.openstack.org/openstack"

+ 13
- 7
zuul.d/build-image.yaml View File

@@ -17,8 +17,8 @@
17 17
 
18 18
 - job:
19 19
     name: tripleo-buildimage-ironic-python-agent-centos-7
20
-    parent: tripleo-ci-dsvm
21
-    run: playbooks/tripleo-buildimage/run.yaml
20
+    parent: tripleo-ci-base
21
+    run: playbooks/tripleo-buildimage/run-v3.yaml
22 22
     post-run: playbooks/tripleo-buildimage/post.yaml
23 23
     timeout: 4200
24 24
     nodeset: single-centos-7-node
@@ -33,9 +33,11 @@
33 33
       - git.openstack.org/openstack/tripleo-common
34 34
       - git.openstack.org/openstack/tripleo-image-elements
35 35
       - git.openstack.org/openstack/tripleo-puppet-elements
36
+      - git.openstack.org/openstack/tripleo-repos
36 37
       - git.openstack.org/openstack/requirements
37 38
     vars:
38 39
       tripleo_image_type: ironic-python-agent
40
+      tripleo_image_os: centos7
39 41
     voting: false
40 42
     irrelevant-files:
41 43
       - ^.*\.rst$
@@ -43,8 +45,8 @@
43 45
 
44 46
 - job:
45 47
     name: tripleo-buildimage-overcloud-full-centos-7
46
-    parent: tripleo-ci-dsvm
47
-    run: playbooks/tripleo-buildimage/run.yaml
48
+    parent: tripleo-ci-base
49
+    run: playbooks/tripleo-buildimage/run-v3.yaml
48 50
     post-run: playbooks/tripleo-buildimage/post.yaml
49 51
     timeout: 4200
50 52
     nodeset: single-centos-7-node
@@ -58,17 +60,19 @@
58 60
       - git.openstack.org/openstack/tripleo-common
59 61
       - git.openstack.org/openstack/tripleo-image-elements
60 62
       - git.openstack.org/openstack/tripleo-puppet-elements
63
+      - git.openstack.org/openstack/tripleo-repos
61 64
     vars:
62 65
       tripleo_image_type: overcloud-full
66
+      tripleo_image_os: centos7
63 67
     irrelevant-files:
64 68
       - ^.*\.rst$
65 69
       - ^releasenotes/.*$
66 70
 
67 71
 - job:
68 72
     name: tripleo-buildimage-overcloud-hardened-full-centos-7
69
-    parent: tripleo-ci-dsvm
70
-    run: playbooks/tripleo-buildimage/run.yaml
71
-    post-run: playbooks/tripleo-build/post.yaml
73
+    parent: tripleo-ci-base
74
+    run: playbooks/tripleo-buildimage/run-v3.yaml
75
+    post-run: playbooks/tripleo-buildimage/post.yaml
72 76
     timeout: 4200
73 77
     nodeset: single-centos-7-node
74 78
     required-projects:
@@ -80,9 +84,11 @@
80 84
       - git.openstack.org/openstack/tripleo-common
81 85
       - git.openstack.org/openstack/tripleo-image-elements
82 86
       - git.openstack.org/openstack/tripleo-puppet-elements
87
+      - git.openstack.org/openstack/tripleo-repos
83 88
       - git.openstack.org/openstack/requirements
84 89
     vars:
85 90
       tripleo_image_type: overcloud-hardened-full
91
+      tripleo_image_os: centos7
86 92
     voting: false
87 93
     irrelevant-files:
88 94
       - ^.*\.rst$

+ 12
- 0
zuul.d/layout.yaml View File

@@ -21,6 +21,15 @@
21 21
         - openstack-tox-py35:
22 22
             files:
23 23
               - ^scripts/emit_releases_file/.*$
24
+        - tripleo-buildimage-overcloud-full-centos-7:
25
+            files:
26
+              - ^playbooks/tripleo-buildimage/.*$
27
+        - tripleo-buildimage-ironic-python-agent-centos-7:
28
+            files:
29
+              - ^playbooks/tripleo-buildimage/.*$
30
+        - tripleo-buildimage-overcloud-hardened-full-centos-7:
31
+            files:
32
+              - ^playbooks/tripleo-buildimage/.*$
24 33
         - tripleo-ci-centos-7-scenario001-multinode-oooq:
25 34
             files:
26 35
               - ^playbooks/tripleo-ci/.*$
@@ -75,6 +84,9 @@
75 84
         - openstack-tox-pep8:
76 85
             files:
77 86
               - ^scripts/emit_releases_file/.*$
87
+        - tripleo-buildimage-overcloud-full-centos-7:
88
+            files:
89
+              - ^playbooks/tripleo-buildimage/.*$
78 90
         - tripleo-ci-centos-7-scenario001-multinode-oooq:
79 91
             files:
80 92
               - ^playbooks/tripleo-ci/.*$

Loading…
Cancel
Save