adding clusterctl upgrade test

Change-Id: If51ae0d252bc9187dc8a82de057a77e3b724f5be
diff --git a/jjb/metal3/defaults.yml b/jjb/metal3/defaults.yml
index 9a35553..c294792 100644
--- a/jjb/metal3/defaults.yml
+++ b/jjb/metal3/defaults.yml
@@ -34,6 +34,7 @@
     ci_github_repo: 'https://github.com/metal3-io/project-infra.git'
     ci_github_pipeline: 'jenkins/jobs/integration_tests.pipeline'
     e2e_feature_test_parallel_pipeline: 'jenkins/jobs/parallel_e2e_features_test.pipeline'
+    e2e_feature_test_pipeline: 'jenkins/jobs/capm3-e2e-tests.pipeline'
     ci_github_jenkins_credentials_id: 'metal3-jenkins-github-username-token'
     # NOTE: auth-id is taken from Jenkins Global Configuration (NOT THE CREDENTIAL STORE!)
     # by clicking Auth ID button for the desired GitHub Server API URL
diff --git a/jjb/metal3/job_capm3_clusterctl_upgrade_tests.yml b/jjb/metal3/job_capm3_clusterctl_upgrade_tests.yml
new file mode 100644
index 0000000..8dc3fea
--- /dev/null
+++ b/jjb/metal3/job_capm3_clusterctl_upgrade_tests.yml
@@ -0,0 +1,123 @@
+---
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2024 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) e2e clusterctl upgrade 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_clusterctl_upgrade_tests
+    name: '{job_prefix}_{proj}_{capm3_target_branch}_clusterctl_upgrade_test_{image_os}'
+    description: "CAPM3 e2e clusterctl upgrade tests for {org}/{repo} on {image_os}."
+    project-type: pipeline
+    defaults: global
+    disabled: False
+    concurrent: True
+    parameters:
+    - string:
+        name: PROJECT_REPO_ORG
+        default: '{org}'
+        description: 'Project github repo org name'
+    - string:
+        name: PROJECT_REPO_NAME
+        default: '{repo}'
+        description: 'Project github repo name'
+    - string:
+        name: ghprbActualCommit
+        default: 'main'
+        description: 'CI Repo branch for triggering manual build'
+    - string:
+        name: ghprbAuthorRepoGitUrl
+        default: 'https://github.com/{org}/{repo}.git'
+        description: 'CI Repo URL for triggering manual build'
+    - string:
+        name: ghprbTargetBranch
+        default: 'main'
+        description: 'Target branch of the PR'
+    - string:
+        name: IMAGE_OS
+        default: '{image_os}'
+        description: 'Distribution to use for the target host as well as source and target cluster. Can be ubuntu or centos'
+    - string:
+        name: capm3_release_branch
+        default: '{capm3_release_branch}'
+        description: 'The target branch of CAPM3 to be used for this test'
+    - string:
+        name: bmo_release_branch
+        default: '{bmo_release_branch}'
+        description: 'The target branch of BMO to be used for this test'
+    - string:
+        name: TARGET_NODE_MEMORY
+        default: 4096
+        description: 'RAM size of the target host.'
+    - string:
+        name: TESTS_FOR
+        default: "e2e_tests"
+        description: 'Tests using the e2e framework.'
+    - string:
+        name: GINKGO_FOCUS
+        default: "clusterctl-upgrade"
+        description: 'Select the e2e upgrade test'
+    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/{org}/{repo}
+
+    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: '.*?/test-upgrade-{capm3_target_branch}.*?'
+        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:
+          - 'main'
+        status-context: "test-e2e-upgrade-{capm3_target_branch}"
+        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: "{e2e_feature_test_pipeline}"
+      lightweight-checkout: False
diff --git a/jjb/metal3/projects.yml b/jjb/metal3/projects.yml
index f2d76d2..48dea4e 100644
--- a/jjb/metal3/projects.yml
+++ b/jjb/metal3/projects.yml
@@ -436,6 +436,39 @@
             target_branches:
             - 'release-1.4'
             - 'release-0.3'
+    - capm3_clusterctl_upgrade_tests:
+        capm3_target_branch:
+        - main:
+            capi_version: v1beta1
+            capm3_version: v1beta1
+            capm3_release_branch: main
+            bmo_release_branch: main
+            target_branches:
+            - 'main'
+        - release-1-6:
+            capi_version: v1beta1
+            capm3_version: v1beta1
+            capm3_release_branch: release-1.6
+            bmo_release_branch: release-0.5
+            target_branches:
+            - 'release-1.6'
+            - 'release-0.5'
+        - release-1-5:
+            capi_version: v1beta1
+            capm3_version: v1beta1
+            capm3_release_branch: release-1.5
+            bmo_release_branch: release-0.4
+            target_branches:
+            - 'release-1.5'
+            - 'release-0.4'
+        - release-1-4:
+            capi_version: v1beta1
+            capm3_version: v1beta1
+            capm3_release_branch: release-1.4
+            bmo_release_branch: release-0.3
+            target_branches:
+            - 'release-1.4'
+            - 'release-0.3'
     - keep_capm3_e2e_integration_tests:
         capm3_target_branch:
         - main: