Parameterize DISTRIBUTION and merge job templates 16/12316/4
authorLennart Jern <lennart.jern@est.tech>
Wed, 2 Feb 2022 10:34:11 +0000 (12:34 +0200)
committerLennart Jern <lennart.jern@est.tech>
Wed, 9 Feb 2022 10:56:03 +0000 (12:56 +0200)
This is an attempt to merge job templates for v1a4_integration_tests so
that instead of having one template for ubuntu and one for centos, we
have a single template and use the distribution variable to render two
separate jobs (for ubuntu and centos respectively).

Change-Id: I0d9563f1f2d545f5aa32f1a9418df63314fa0b4a

jjb/metal3/job_capm3_v1a4_integration_tests.yml [moved from jjb/metal3/job_capm3_v1a4_integration_tests_centos.yml with 92% similarity]
jjb/metal3/job_capm3_v1a4_integration_tests_ubuntu.yml [deleted file]
jjb/metal3/projects.yml

similarity index 92%
rename from jjb/metal3/job_capm3_v1a4_integration_tests_centos.yml
rename to jjb/metal3/job_capm3_v1a4_integration_tests.yml
index 51ee1bf1c3726d4e1bacbe556bf062436f09d873..feb4d7d2b8dbb6a73a11d72bcf418c33a77e14ab 100644 (file)
@@ -25,9 +25,9 @@
 # pipeline job. The pipeline scripts are maintained in Metal3 CI project infra repository.
 
 - job-template:
-    id: capm3_v1a4_integration_tests_centos
-    name: '{job_prefix}_{name}_v1a4_integration_test_centos'
-    description: "CAPM3 v1alpha4 integration tests for {repo[org]}/{repo[name]} on CentOS."
+    id: capm3_v1a4_integration_tests
+    name: '{job_prefix}_{name}_v1a4_integration_test_{distribution}'
+    description: "CAPM3 v1alpha4 integration tests for {repo[org]}/{repo[name]} on {distribution}."
     project-type: pipeline
     defaults: global
     disabled: False
@@ -55,7 +55,7 @@
         description: 'Target branch of the PR'
     - string:
         name: DISTRIBUTION
-        default: 'centos'
+        default: '{distribution}'
         description: 'Distribution to use for the target host and the tests. Can be ubuntu or centos'
     - string:
         name: CAPI_VERSION
@@ -86,7 +86,7 @@
         org-list: "{ci_github_whitelist_org}"
         cron: 'H/5 * * * *'
         auth-id: "{ci_ghprb_auth_id}"
-        trigger-phrase: '((.|\n)*\s)?/test-v1a4-centos-integration(\s(.|\n)*)?'
+        trigger-phrase: '((.|\n)*\s)?/test-v1a4-{distribution}-integration(\s(.|\n)*)?'
         skip-build-phrase: '/skip-test'
         only-trigger-phrase: True
         github-hooks: True
@@ -98,7 +98,7 @@
           - 'main'
           - 'release-0.4'
           - 'release-0.0'
-        status-context: "test-v1a4-centos-integration"
+        status-context: "test-v1a4-{distribution}-integration"
         success-status: "Passed"
         failure-status: "Failed"
         error-status: "Error"
diff --git a/jjb/metal3/job_capm3_v1a4_integration_tests_ubuntu.yml b/jjb/metal3/job_capm3_v1a4_integration_tests_ubuntu.yml
deleted file mode 100644 (file)
index 3aac6dc..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
----
-#
-# ============LICENSE_START=======================================================
-#  Copyright (C) 2019 Nordix Foundation.
-# ================================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-# Description:
-# ============
-# This file contains job template definition for Cluster API Provider Metal3 (CAPM3) integration tests.
-# This job can be triggered manually or through a Github pull request. It creates a
-# pipeline job. The pipeline scripts are maintained in Metal3 CI project infra repository.
-
-- job-template:
-    id: capm3_v1a4_integration_tests_ubuntu
-    name: '{job_prefix}_{name}_v1a4_integration_test_ubuntu'
-    description: "CAPM3 v1alpha4 integration tests for {repo[org]}/{repo[name]} on Ubuntu."
-    project-type: pipeline
-    defaults: global
-    disabled: False
-    concurrent: True
-    parameters:
-    - string:
-        name: PROJECT_REPO_ORG
-        default: '{repo[org]}'
-        description: 'Project github repo org name'
-    - string:
-        name: PROJECT_REPO_NAME
-        default: '{repo[name]}'
-        description: 'Project github repo name'
-    - string:
-        name: ghprbActualCommit
-        default: 'master'
-        description: 'CI Repo branch for triggering manual build'
-    - string:
-        name: ghprbAuthorRepoGitUrl
-        default: 'https://github.com/{repo[org]}/{repo[name]}.git'
-        description: 'CI Repo URL for triggering manual build'
-    - string:
-        name: ghprbTargetBranch
-        default: 'master'
-        description: 'Target branch of the PR'
-    - string:
-        name: DISTRIBUTION
-        default: 'ubuntu'
-        description: 'Distribution to use for the target host and the tests. Can be ubuntu or centos'
-    - string:
-        name: CAPI_VERSION
-        default: 'v1alpha3'
-        description: 'Cluster API version. Can be v1alpha3.'
-    - string:
-        name: CAPM3_VERSION
-        default: 'v1alpha4'
-        description: 'Cluster API provider Metal3 version. Can be v1alpha4 or v1alpha5.'
-    - string:
-        name: TARGET_NODE_MEMORY
-        default: 4096
-        description: 'RAM size of the target host.'
-
-    properties:
-    - build-discarder:
-        days-to-keep: 30
-        num-to-keep: 300
-        artifact-days-to-keep: -1
-        artifact-num-to-keep: -1
-    - github:
-        url: https://github.com/{repo[org]}/{repo[name]}
-
-    triggers:
-    - github-pull-request:
-        admin-list:
-          - '{ci_github_admin_user}'
-        org-list: "{ci_github_whitelist_org}"
-        cron: 'H/5 * * * *'
-        auth-id: "{ci_ghprb_auth_id}"
-        trigger-phrase: '((.|\n)*\s)?/test-v1a4-integration(\s(.|\n)*)?'
-        skip-build-phrase: '/skip-test'
-        only-trigger-phrase: True
-        github-hooks: True
-        permit-all: False
-        auto-close-on-fail: False
-        allow-whitelist-orgs-as-admins: True
-        white-list-target-branches:
-          - 'master'
-          - 'main'
-          - 'release-0.4'
-          - 'release-0.0'
-        status-context: "test-v1a4-integration"
-        success-status: "Passed"
-        failure-status: "Failed"
-        error-status: "Error"
-        cancel-builds-on-update: True
-    pipeline-scm:
-      scm:
-      - git:
-          url: "{ci_github_repo}"
-          credentials-id: "{ci_github_jenkins_credentials_id}"
-          branches:
-            - '{branch|main}'
-          name: 'origin'
-          refspec: '+refs/heads/*:refs/remotes/origin/*'
-          wipe-workspace: True
-          honor-refspec: True
-          shallow-clone: False
-      script-path: "{ci_github_pipeline}"
-      lightweight-checkout: False
index ef6530e383ea381d661a4b24f1ac3da1873335d0..50e3a13327a6e51970acb5014b838a996b963308 100644 (file)
       name: "project-infra"
     ci_github_repo: '${{ghprbAuthorRepoGitUrl}}'
     jobs:
-    - capm3_v1a4_integration_tests_centos
-    - capm3_v1a4_integration_tests_ubuntu
+    - capm3_v1a4_integration_tests:
+        distribution:
+          - ubuntu
+          - centos
     - capm3_v1a5_integration_tests_centos
     - capm3_v1a5_integration_tests_ubuntu
     - capm3_v1b1_integration_tests_centos
       org: "metal3-io"
       name: "baremetal-operator"
     jobs:
-    - capm3_v1a4_integration_tests_centos
-    - capm3_v1a4_integration_tests_ubuntu
+    - capm3_v1a4_integration_tests:
+        distribution:
+          - ubuntu
+          - centos
     - capm3_v1a5_integration_tests_centos
     - capm3_v1a5_integration_tests_ubuntu
     - capm3_v1b1_integration_tests_centos
       org: "metal3-io"
       name: "ip-address-manager"
     jobs:
-    - capm3_v1a4_integration_tests_centos
-    - capm3_v1a4_integration_tests_ubuntu
+    - capm3_v1a4_integration_tests:
+        distribution:
+          - ubuntu
+          - centos
     - capm3_v1a5_integration_tests_centos
     - capm3_v1a5_integration_tests_ubuntu
     - capm3_v1b1_integration_tests_centos
 - project:
     name: "metal3_dev_env"
     jobs:
-    - capm3_v1a4_integration_tests_centos
-    - capm3_v1a4_integration_tests_ubuntu
+    - capm3_v1a4_integration_tests:
+        distribution:
+          - ubuntu
+          - centos
     - capm3_v1a4_main_integration_tests_centos
     - capm3_v1a4_main_integration_tests_ubuntu
     - capm3_v1a5_integration_tests_centos
       org: "metal3-io"
       name: "cluster-api-provider-metal3"
     jobs:
-    - capm3_v1a4_integration_tests_centos
-    - capm3_v1a4_integration_tests_ubuntu
+    - capm3_v1a4_integration_tests:
+        distribution:
+          - ubuntu
+          - centos
     - capm3_v1a5_integration_tests_centos
     - capm3_v1a5_integration_tests_ubuntu
     - capm3_v1a5_e2e_tests_ubuntu
       org: "metal3-io"
       name: "ironic-image"
     jobs:
-    - capm3_v1a4_integration_tests_centos
-    - capm3_v1a4_integration_tests_ubuntu
+    - capm3_v1a4_integration_tests:
+        distribution:
+          - ubuntu
+          - centos
     - capm3_v1a5_integration_tests_centos
     - capm3_v1a5_integration_tests_ubuntu
     - capm3_v1b1_integration_tests_centos
       org: "metal3-io"
       name: "ironic-ipa-downloader"
     jobs:
-    - capm3_v1a4_integration_tests_ubuntu
+    - capm3_v1a4_integration_tests:
+        distribution: ubuntu
     - capm3_v1a5_integration_tests_ubuntu
     - capm3_v1b1_integration_tests_centos
     - capm3_v1b1_integration_tests_ubuntu