Browse Source

Add zuul v3 jobs in stable/ocata

Change-Id: Id2212fd5cb9caee538664308540c75b7bdaddbbb
(cherry picked from commit 839884593e)
changes/67/515367/1
yatin 1 year ago
parent
commit
43d623ec0c

+ 20
- 0
.zuul.yaml View File

@@ -0,0 +1,20 @@
1
+- project:
2
+    name: openstack/magnum
3
+    check:
4
+      jobs:
5
+        - magnum-functional-api
6
+        - magnum-functional-k8s
7
+        - magnum-functional-swarm-mode
8
+    gate:
9
+      jobs:
10
+        - magnum-functional-api
11
+    experimental:
12
+      jobs:
13
+        - magnum-functional-dcos
14
+        - magnum-functional-mesos
15
+        - magnum-functional-swarm
16
+        - magnum-functional-k8s-ironic
17
+        - magnum-functional-swarm-ironic
18
+        - magnum-functional-k8s-multinode
19
+        - magnum-functional-swarm-mode-multinode
20
+        - magnum-non-functional-tox-migration

+ 4
- 4
magnum/tests/contrib/post_test_hook.sh View File

@@ -148,7 +148,7 @@ constraints="-c $REQUIREMENTS_DIR/upper-constraints.txt"
148 148
 sudo -H pip install $constraints -U -r requirements.txt -r test-requirements.txt
149 149
 
150 150
 export MAGNUM_DIR="$BASE/new/magnum"
151
-sudo chown -R jenkins:stack $MAGNUM_DIR
151
+sudo chown -R $USER:stack $MAGNUM_DIR
152 152
 
153 153
 # Run functional tests
154 154
 # Currently we support functional-api, functional-k8s, will support swarm,
@@ -170,7 +170,7 @@ if [[ "api" == "$coe" ]]; then
170 170
     source $BASE/new/devstack/functions
171 171
     echo "TEMPEST_SERVICES+=,magnum" >> $localrc_path
172 172
     pushd $BASE/new/tempest
173
-    sudo chown -R jenkins:stack $BASE/new/tempest
173
+    sudo chown -R $USER:stack $BASE/new/tempest
174 174
 
175 175
     # Set demo credentials
176 176
     source $BASE/new/devstack/accrc/demo/demo
@@ -193,7 +193,7 @@ if [[ "api" == "$coe" ]]; then
193 193
     export MAGNUM_TESTS=${MAGNUM_TESTS:-'magnum.tests.functional.api.v1'}
194 194
 
195 195
     echo "Running tempest magnum test suites"
196
-    sudo -H -u jenkins tox -eall-plugin -- $MAGNUM_TESTS --concurrency=$MAGNUM_TEMPEST_CONCURRENCY
196
+    sudo -H -u $USER tox -eall-plugin -- $MAGNUM_TESTS --concurrency=$MAGNUM_TEMPEST_CONCURRENCY
197 197
 else
198 198
     # Get admin credentials
199 199
     pushd ../devstack
@@ -203,7 +203,7 @@ else
203 203
     create_test_data $coe $special
204 204
 
205 205
     target="${coe}${special}"
206
-    sudo -E -H -u jenkins tox -e functional-"$target" -- --concurrency=1
206
+    sudo -E -H -u $USER tox -e functional-"$target" -- --concurrency=1
207 207
 fi
208 208
 EXIT_CODE=$?
209 209
 

+ 102
- 0
playbooks/magnum-buildimages-base.yaml View File

@@ -0,0 +1,102 @@
1
+- hosts: primary
2
+  tasks:
3
+
4
+    - shell:
5
+        cmd: |
6
+          set -u
7
+          set -e
8
+          set -x
9
+          cd ~
10
+
11
+          if [[ "{{ image_name }}" =~ ^(ubuntu-mesos|centos-dcos)$ ]]; then
12
+              EXTRA_PROJECTS="openstack/tripleo-image-elements openstack/heat-templates"
13
+          else
14
+              EXTRA_PROJECTS=""
15
+          fi
16
+
17
+          /usr/zuul-env/bin/zuul-cloner --cache-dir /opt/git \
18
+            git://git.openstack.org \
19
+            openstack/diskimage-builder \
20
+            openstack/dib-utils \
21
+            openstack/magnum $EXTRA_PROJECTS
22
+
23
+          virtualenv env
24
+
25
+          ./env/bin/pip install $(pwd)/openstack/dib-utils
26
+          ./env/bin/pip install $(pwd)/openstack/diskimage-builder
27
+
28
+          # TODO(pabelanger): Remove once we migrated to bindep
29
+          ./openstack/diskimage-builder/tests/install_test_deps.sh
30
+
31
+          # activate the virtualenv so that any tools run by dib run
32
+          # using the python inside it
33
+          set +u
34
+          source ./env/bin/activate
35
+          set -u
36
+
37
+          DIB_ELEMENTS=./openstack/diskimage-builder/diskimage_builder/elements
38
+
39
+          if [ "{{ image_name }}" == "ubuntu-mesos" ]; then
40
+              TRIPLEO_ELEMENTS=./openstack/tripleo-image-elements/elements
41
+              HEAT_ELEMENTS=./openstack/heat-templates/hot/software-config/elements
42
+              MESOS_ELEMENTS=./openstack/magnum/magnum/drivers/mesos_ubuntu_v1/image
43
+              export ELEMENTS_PATH=$TRIPLEO_ELEMENTS:$HEAT_ELEMENTS:$MESOS_ELEMENTS
44
+
45
+              $MESOS_ELEMENTS/install_imagebuild_deps.sh
46
+
47
+              export DIB_RELEASE=trusty
48
+
49
+              export DIB_IMAGE_SIZE=2.2
50
+
51
+              disk-image-create ubuntu vm docker mesos \
52
+                os-collect-config os-refresh-config os-apply-config \
53
+                heat-config heat-config-script -o $WORKSPACE/{{ image_name }}.qcow2
54
+
55
+              $MESOS_ELEMENTS/validate_image.sh $WORKSPACE/{{ image_name }}.qcow2
56
+          elif [ "{{ image_name }}" == "centos-dcos" ]; then
57
+              DCOS_ELEMENTS=./openstack/magnum/contrib/drivers/dcos_centos_v1/image
58
+              TRIPLEO_ELEMENTS=./openstack/tripleo-image-elements/elements
59
+              HEAT_ELEMENTS=./openstack/heat-templates/hot/software-config/elements
60
+              # Order matters, we need the docker elements from DCOS_ELEMENTS to be used first
61
+              export ELEMENTS_PATH=$DCOS_ELEMENTS:$DIB_ELEMENTS:$TRIPLEO_ELEMENTS:$HEAT_ELEMENTS
62
+
63
+              $DCOS_ELEMENTS/install_imagebuild_deps.sh
64
+
65
+              export DIB_IMAGE_SIZE=3.0
66
+
67
+              export FS_TYPE=xfs
68
+
69
+              curl -O https://downloads.dcos.io/dcos/stable/commit/e64024af95b62c632c90b9063ed06296fcf38ea5/dcos_generate_config.sh
70
+              export DCOS_GENERATE_CONFIG_SRC=`pwd`/dcos_generate_config.sh
71
+
72
+              disk-image-create \
73
+                centos7 vm docker dcos selinux-permissive \
74
+                os-collect-config os-refresh-config os-apply-config \
75
+                heat-config heat-config-script \
76
+                -o $WORKSPACE/{{ image_name }}.qcow2
77
+
78
+              #TODO: Add size validation
79
+          else
80
+              MAGNUM_ELEMENTS=./openstack/magnum/magnum/drivers/common/image
81
+              export ELEMENTS_PATH=$DIB_ELEMENTS:$MAGNUM_ELEMENTS
82
+              $MAGNUM_ELEMENTS/fedora-atomic/install_imagebuild_deps.sh
83
+
84
+              export DIB_RELEASE="25"
85
+
86
+              export DIB_IMAGE_SIZE=2.5
87
+
88
+              export FEDORA_ATOMIC_TREE_URL="https://kojipkgs.fedoraproject.org/atomic/25/"
89
+              export FEDORA_ATOMIC_TREE_REF="8b15e9b988b4b02f4cb8b39bdd63d182ab7004a8926ecdac6314ee5c7ffa646b"
90
+
91
+              disk-image-create -x -o $WORKSPACE/{{ image_name }}-dib fedora-atomic
92
+
93
+              # validate image
94
+              $MAGNUM_ELEMENTS/fedora-atomic/validate_atomic_image.sh $WORKSPACE/{{ image_name }}-dib.qcow2
95
+          fi
96
+
97
+          set +u
98
+          deactivate
99
+          set -u
100
+        executable: /bin/bash
101
+        chdir: '{{ ansible_user_dir }}/workspace'
102
+      environment: '{{ zuul | zuul_legacy_vars }}'

+ 82
- 0
playbooks/magnum-functional-base.yaml View File

@@ -0,0 +1,82 @@
1
+- hosts: primary
2
+  tasks:
3
+    - shell:
4
+        cmd: |
5
+          set -e
6
+          set -x
7
+          export PYTHONUNBUFFERED=true
8
+
9
+          if [ "{{ neutron }}" -eq 1 ] ; then
10
+              export DEVSTACK_GATE_NEUTRON=1
11
+          fi
12
+
13
+          export DEVSTACK_GATE_TEMPEST=1
14
+          if [ "{{ tempest }}" -eq 0 ] ; then
15
+              # Do not run any tempest tests
16
+              export DEVSTACK_GATE_TEMPEST_NOTESTS=1
17
+          fi
18
+
19
+          if [ "{{ branch_override }}" != "default" ] ; then
20
+              export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
21
+          fi
22
+
23
+          export PROJECTS="openstack/magnum $PROJECTS"
24
+          export PROJECTS="openstack/python-magnumclient $PROJECTS"
25
+          export PROJECTS="openstack/diskimage-builder $PROJECTS"
26
+
27
+          if [ "{{ multinode }}" -eq 1 ] ; then
28
+              export DEVSTACK_GATE_TOPOLOGY="multinode"
29
+              export DEVSTACK_SUBNODE_CONFIG+=$'\n'"disable_service tempest"
30
+          fi
31
+
32
+          if [ "{{ ironic }}" -eq 1 ] ; then
33
+              export PROJECTS="openstack/ironic $PROJECTS"
34
+              export PROJECTS="openstack/ironic-lib $PROJECTS"
35
+              export PROJECTS="openstack/ironic-python-agent $PROJECTS"
36
+              export PROJECTS="openstack/python-ironicclient $PROJECTS"
37
+              export PROJECTS="openstack/pyghmi $PROJECTS"
38
+              export PROJECTS="openstack/virtualbmc $PROJECTS"
39
+              export MAGNUM_GATE_SPECIAL="-ironic"
40
+          fi
41
+
42
+          if [ "{{ horizon }}" -eq 0 ] ; then
43
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service horizon"
44
+          else
45
+              export DEVSTACK_GATE_HORIZON=1
46
+          fi
47
+          if [ "{{ swift }}" -eq 0 ] ; then
48
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service s-account"
49
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service s-container"
50
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service s-object"
51
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service s-proxy"
52
+          fi
53
+          if [ "{{ ceilometer }}" -eq 0 ] ; then
54
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service ceilometer-acentral"
55
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service ceilometer-acompute"
56
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service ceilometer-alarm-evaluator"
57
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service ceilometer-alarm-notifier"
58
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service ceilometer-api"
59
+              export DEVSTACK_LOCAL_CONFIG+=$'\n'"disable_service ceilometer-collector"
60
+          fi
61
+
62
+          # Keep localrc to be able to set some vars in post_test_hook
63
+          export KEEP_LOCALRC=1
64
+
65
+          function gate_hook {
66
+              cd /opt/stack/new/magnum/
67
+              ./magnum/tests/contrib/gate_hook.sh {{ coe }} $MAGNUM_GATE_SPECIAL
68
+          }
69
+          export -f gate_hook
70
+
71
+          function post_test_hook {
72
+              source $BASE/new/devstack/accrc/admin/admin
73
+              cd /opt/stack/new/magnum/
74
+              ./magnum/tests/contrib/post_test_hook.sh {{ coe }} $MAGNUM_GATE_SPECIAL
75
+          }
76
+          export -f post_test_hook
77
+
78
+          cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh
79
+          ./safe-devstack-vm-gate-wrap.sh
80
+        executable: /bin/bash
81
+        chdir: '{{ ansible_user_dir }}/workspace'
82
+      environment: '{{ zuul | zuul_legacy_vars }}'

+ 85
- 0
playbooks/magnum-tox-migration.yaml View File

@@ -0,0 +1,85 @@
1
+- hosts: primary
2
+  tasks:
3
+
4
+    - name: Ensure workspace directory
5
+      file:
6
+        path: '{{ ansible_user_dir }}/workspace'
7
+        state: directory
8
+
9
+    - shell:
10
+        cmd: |
11
+          set -e
12
+          set -x
13
+          CLONEMAP=`mktemp`
14
+          REQS_DIR=`mktemp -d`
15
+          function cleanup {
16
+              mkdir -p $WORKSPACE
17
+              rm -rf $CLONEMAP $REQS_DIR
18
+          }
19
+          trap cleanup EXIT
20
+          cat > $CLONEMAP << EOF
21
+          clonemap:
22
+            - name: $ZUUL_PROJECT
23
+              dest: .
24
+          EOF
25
+          # zuul cloner works poorly if there are 2 names that are the
26
+          # same in here.
27
+          if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then
28
+          cat >> $CLONEMAP << EOF
29
+            - name: openstack/requirements
30
+              dest: $REQS_DIR
31
+          EOF
32
+          fi
33
+          /usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
34
+              git://git.openstack.org $ZUUL_PROJECT openstack/requirements
35
+          # REQS_DIR is not set for openstack/requirements and there is also
36
+          # no need to copy in this case.
37
+          if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then
38
+              cp $REQS_DIR/upper-constraints.txt ./
39
+          fi
40
+        executable: /bin/bash
41
+        chdir: '{{ ansible_user_dir }}/workspace'
42
+      environment: '{{ zuul | zuul_legacy_vars }}'
43
+
44
+    - shell:
45
+        cmd: /usr/local/jenkins/slave_scripts/install-distro-packages.sh
46
+        chdir: '{{ ansible_user_dir }}/workspace'
47
+      environment: '{{ zuul | zuul_legacy_vars }}'
48
+
49
+    - shell:
50
+        cmd: |
51
+          if [ -x tools/test-setup.sh ] ; then
52
+            tools/test-setup.sh
53
+          fi
54
+        chdir: '{{ ansible_user_dir }}/workspace'
55
+      environment: '{{ zuul | zuul_legacy_vars }}'
56
+
57
+    - shell:
58
+        cmd: |
59
+          set -x
60
+          sudo rm -f /etc/sudoers.d/zuul
61
+          # Prove that general sudo access is actually revoked
62
+          ! sudo -n true
63
+        executable: /bin/bash
64
+        chdir: '{{ ansible_user_dir }}/workspace'
65
+      environment: '{{ zuul | zuul_legacy_vars }}'
66
+
67
+    - shell:
68
+        cmd: /usr/local/jenkins/slave_scripts/run-tox.sh migration
69
+        chdir: '{{ ansible_user_dir }}/workspace'
70
+      environment: '{{ zuul | zuul_legacy_vars }}'
71
+
72
+    - shell:
73
+        cmd: |
74
+          OUT=`git ls-files --other --exclude-standard --directory`
75
+          if [ -z "$OUT" ]; then
76
+              echo "No extra files created during test."
77
+              exit 0
78
+          else
79
+              echo "The following un-ignored files were created during the test:"
80
+              echo "$OUT"
81
+              exit 0  # TODO: change to 1 to fail tests.
82
+          fi
83
+        executable: /bin/bash
84
+        chdir: '{{ ansible_user_dir }}/workspace'
85
+      environment: '{{ zuul | zuul_legacy_vars }}'

+ 21
- 0
playbooks/post/upload-images.yaml View File

@@ -0,0 +1,21 @@
1
+- hosts: primary
2
+  tasks:
3
+
4
+    - name: Ensure artifacts directory exists
5
+      file:
6
+        path: '{{ zuul.executor.work_root }}/artifacts'
7
+        state: directory
8
+      delegate_to: localhost
9
+
10
+    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
11
+      synchronize:
12
+        src: '{{ ansible_user_dir }}/workspace/'
13
+        dest: '{{ zuul.executor.work_root }}/artifacts/images'
14
+        mode: pull
15
+        copy_links: true
16
+        verify_host: true
17
+        rsync_opts:
18
+          - --include=/*.qcow2
19
+          - --include=*/
20
+          - --exclude=*
21
+          - --prune-empty-dirs

+ 67
- 0
playbooks/post/upload-logs-tox.yaml View File

@@ -0,0 +1,67 @@
1
+- hosts: primary
2
+  tasks:
3
+
4
+    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
5
+      synchronize:
6
+        src: '{{ ansible_user_dir }}/workspace/'
7
+        dest: '{{ zuul.executor.log_root }}'
8
+        mode: pull
9
+        copy_links: true
10
+        verify_host: true
11
+        rsync_opts:
12
+          - --include=**/*nose_results.html
13
+          - --include=*/
14
+          - --exclude=*
15
+          - --prune-empty-dirs
16
+
17
+    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
18
+      synchronize:
19
+        src: '{{ ansible_user_dir }}/workspace/'
20
+        dest: '{{ zuul.executor.log_root }}'
21
+        mode: pull
22
+        copy_links: true
23
+        verify_host: true
24
+        rsync_opts:
25
+          - --include=**/*testr_results.html.gz
26
+          - --include=*/
27
+          - --exclude=*
28
+          - --prune-empty-dirs
29
+
30
+    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
31
+      synchronize:
32
+        src: '{{ ansible_user_dir }}/workspace/'
33
+        dest: '{{ zuul.executor.log_root }}'
34
+        mode: pull
35
+        copy_links: true
36
+        verify_host: true
37
+        rsync_opts:
38
+          - --include=/.testrepository/tmp*
39
+          - --include=*/
40
+          - --exclude=*
41
+          - --prune-empty-dirs
42
+
43
+    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
44
+      synchronize:
45
+        src: '{{ ansible_user_dir }}/workspace/'
46
+        dest: '{{ zuul.executor.log_root }}'
47
+        mode: pull
48
+        copy_links: true
49
+        verify_host: true
50
+        rsync_opts:
51
+          - --include=**/*testrepository.subunit.gz
52
+          - --include=*/
53
+          - --exclude=*
54
+          - --prune-empty-dirs
55
+
56
+    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
57
+      synchronize:
58
+        src: '{{ ansible_user_dir }}/workspace/'
59
+        dest: '{{ zuul.executor.log_root }}/tox'
60
+        mode: pull
61
+        copy_links: true
62
+        verify_host: true
63
+        rsync_opts:
64
+          - --include=/.tox/*/log/*
65
+          - --include=*/
66
+          - --exclude=*
67
+          - --prune-empty-dirs

+ 14
- 0
playbooks/post/upload-logs.yaml View File

@@ -0,0 +1,14 @@
1
+- hosts: primary
2
+  tasks:
3
+    - name: Copy files from {{ ansible_user_dir }}/workspace/ on node
4
+      synchronize:
5
+        src: '{{ ansible_user_dir }}/workspace/'
6
+        dest: '{{ zuul.executor.log_root }}'
7
+        mode: pull
8
+        copy_links: true
9
+        verify_host: true
10
+        rsync_opts:
11
+          - --include=/logs/**
12
+          - --include=*/
13
+          - --exclude=*
14
+          - --prune-empty-dirs

+ 12
- 0
playbooks/pre/prepare-workspace-images.yaml View File

@@ -0,0 +1,12 @@
1
+- hosts: all
2
+  tasks:
3
+
4
+    - name: Ensure legacy workspace directory
5
+      file:
6
+        path: '{{ ansible_user_dir }}/workspace'
7
+        state: directory
8
+
9
+    - shell:
10
+        cmd: /usr/local/jenkins/slave_scripts/install-distro-packages.sh
11
+        chdir: '{{ ansible_user_dir }}/workspace'
12
+      environment: '{{ zuul | zuul_legacy_vars }}'

+ 23
- 0
playbooks/pre/prepare-workspace.yaml View File

@@ -0,0 +1,23 @@
1
+- hosts: all
2
+  name: magnum-prepare-workspace
3
+  tasks:
4
+    - name: Ensure workspace directory exists
5
+      file:
6
+        path: '{{ ansible_user_dir }}/workspace'
7
+        state: directory
8
+
9
+    - shell:
10
+        cmd: |
11
+          set -e
12
+          set -x
13
+          cat > clonemap.yaml << EOF
14
+          clonemap:
15
+            - name: openstack-infra/devstack-gate
16
+              dest: devstack-gate
17
+          EOF
18
+          /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
19
+              git://git.openstack.org \
20
+              openstack-infra/devstack-gate
21
+        executable: /bin/bash
22
+        chdir: '{{ ansible_user_dir }}/workspace'
23
+      environment: '{{ zuul | zuul_legacy_vars }}'

Loading…
Cancel
Save