From 114c05319de4586c416c9fec3330fb7ff21e978e Mon Sep 17 00:00:00 2001 From: Ashwin Hendre Date: Mon, 9 Dec 2024 14:05:57 +0530 Subject: [PATCH] Convert unit, integration test and integration-CLI jobs to postsubmits --- .../periodic/docker/periodic-ci-docker.yaml | 151 +++------------- .../build-docker/postsubmit-ci-docker.yaml | 161 ++++++++++++++++++ 2 files changed, 187 insertions(+), 125 deletions(-) create mode 100644 config/jobs/ppc64le-cloud/build-docker/postsubmit-ci-docker.yaml diff --git a/config/jobs/periodic/docker/periodic-ci-docker.yaml b/config/jobs/periodic/docker/periodic-ci-docker.yaml index 3683d0e8..60aa9900 100644 --- a/config/jobs/periodic/docker/periodic-ci-docker.yaml +++ b/config/jobs/periodic/docker/periodic-ci-docker.yaml @@ -10,9 +10,12 @@ periodics: org: ppc64le-cloud repo: docker-ce-build reporter_config: - slack: - channel: 'prow-job-notifications' - report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' + slack: + channel: 'prow-job-notifications' + job_states_to_report: + - failure + - error + report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' spec: containers: - image: quay.io/powercloud/docker-ce-build@sha256:b1e2679b9a5aabe15a94ae3130f5b02ce67441cf361fda7dc7a41929bb50ba87 @@ -30,6 +33,14 @@ periodics: set -o nounset set -o pipefail set -o xtrace + + # Set the SSH key for git from the secret 'git-ssh-docker-ce-build' + echo "* Set up the ssh key for git *" + mkdir -p ~/.ssh + cp /etc/ssh-key/ssh-privatekey ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts + echo "* Start prow-info-docker *" chmod ug+x $PWD/upstream-master-ci/prow-info-docker.sh $PWD/upstream-master-ci/prow-info-docker.sh @@ -41,15 +52,23 @@ periodics: volumeMounts: - name: boot mountPath: /boot + - name: ssh-key + readOnly: true + mountPath: /etc/ssh-key volumes: - name: boot hostpath: path: /boot/ + volumes: + - name: ssh-key + secret: + secretName: git-ssh-docker-ce-build + - name: periodic-build-dev-image-docker cluster: k8s-ppc64le-cluster labels: preset-build-docker: "true" - cron: 0 3 * * * + cron: 10 0 * * * decorate: true extra_refs: - base_ref: main @@ -58,6 +77,9 @@ periodics: reporter_config: slack: channel: 'prow-job-notifications' + job_states_to_report: + - failure + - error report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' spec: containers: @@ -84,124 +106,3 @@ periodics: exit $rc securityContext: privileged: true - - name: periodic-unit-test-docker - cluster: k8s-ppc64le-cluster - labels: - preset-build-docker: "true" - cron: 0 9 * * * - decorate: true - extra_refs: - - base_ref: main - org: ppc64le-cloud - repo: docker-ce-build - reporter_config: - slack: - channel: 'prow-job-notifications' - report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' - spec: - containers: - - image: quay.io/powercloud/docker-ce-build@sha256:b1e2679b9a5aabe15a94ae3130f5b02ce67441cf361fda7dc7a41929bb50ba87 - resources: - requests: - cpu: "4000m" - limits: - cpu: "4000m" - command: - - /bin/bash - args: - - -c - - | - set -o errexit - set -o nounset - set -o pipefail - set -o xtrace - echo "* Start prow-unit-test-docker *" - chmod ug+x $PWD/upstream-master-ci/prow-unit-test-docker.sh - $PWD/upstream-master-ci/prow-unit-test-docker.sh - rc=$? - [ $rc != 0 ] && echo "ERROR: prow-unit-test-docker exited with code:$rc" - exit $rc - securityContext: - privileged: true - - name: periodic-integration-cli-docker - cluster: k8s-ppc64le-cluster - labels: - preset-build-docker: "true" - cron: 0 14 * * * - decorate: true - decoration_config: - timeout: 3h - extra_refs: - - base_ref: main - org: ppc64le-cloud - repo: docker-ce-build - reporter_config: - slack: - channel: 'prow-job-notifications' - report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' - spec: - containers: - - image: quay.io/powercloud/docker-ce-build@sha256:b1e2679b9a5aabe15a94ae3130f5b02ce67441cf361fda7dc7a41929bb50ba87 - resources: - requests: - cpu: "4000m" - limits: - cpu: "4000m" - command: - - /bin/bash - args: - - -c - - | - set -o errexit - set -o nounset - set -o pipefail - set -o xtrace - echo "* Start prow-integration-cli-tests *" - chmod ug+x $PWD/upstream-master-ci/prow-integration-cli.sh - $PWD/upstream-master-ci/prow-integration-cli.sh - rc=$? - [ $rc != 0 ] && echo "ERROR: prow-integration-cli-tests exited with code:$rc" - exit $rc - securityContext: - privileged: true - - name: periodic-integration-test-docker - cluster: k8s-ppc64le-cluster - labels: - preset-build-docker: "true" - cron: 30 14 * * * - decorate: true - decoration_config: - timeout: 3h - extra_refs: - - base_ref: main - org: ppc64le-cloud - repo: docker-ce-build - reporter_config: - slack: - channel: 'prow-job-notifications' - report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' - spec: - containers: - - image: quay.io/powercloud/docker-ce-build@sha256:b1e2679b9a5aabe15a94ae3130f5b02ce67441cf361fda7dc7a41929bb50ba87 - resources: - requests: - cpu: "4000m" - limits: - cpu: "4000m" - command: - - /bin/bash - args: - - -c - - | - set -o errexit - set -o nounset - set -o pipefail - set -o xtrace - echo "* Start prow-integration-tests *" - chmod ug+x $PWD/upstream-master-ci/prow-integration-tests.sh - $PWD/upstream-master-ci/prow-integration-tests.sh - rc=$? - [ $rc != 0 ] && echo "ERROR: prow-integration-tests exited with code:$rc" - exit $rc - securityContext: - privileged: true diff --git a/config/jobs/ppc64le-cloud/build-docker/postsubmit-ci-docker.yaml b/config/jobs/ppc64le-cloud/build-docker/postsubmit-ci-docker.yaml new file mode 100644 index 00000000..93dfa58d --- /dev/null +++ b/config/jobs/ppc64le-cloud/build-docker/postsubmit-ci-docker.yaml @@ -0,0 +1,161 @@ +postsubmits: + ppc64le-cloud/docker-ce-build: + - name: postsubmit-unit-test-docker + cluster: k8s-ppc64le-cluster + labels: + preset-build-docker: "true" + decorate: true + decoration_config: + timeout: 2h + run_if_changed: 'job/periodic-config-docker' + reporter_config: + slack: + channel: 'prow-job-notifications' + job_states_to_report: + - failure + - error + report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' + branches: + - prow-job-tracking + spec: + containers: + - image: quay.io/powercloud/docker-ce-build@sha256:b1e2679b9a5aabe15a94ae3130f5b02ce67441cf361fda7dc7a41929bb50ba87 + resources: + requests: + cpu: "4000m" + limits: + cpu: "4000m" + command: + - /bin/bash + args: + - -c + - | + ## + # This job is populated with the files from the 'prow-job-tracking' branch. + # We switch to the 'main' branch, as it contains the scripts used by this job. + ### + + set -o errexit + set -o nounset + set -o pipefail + set -o xtrace + + #Set this to your dev branch for testing + WORK_BRANCH=main + git fetch https://github.com/${REPO_OWNER}/${REPO_NAME} ${WORK_BRANCH} + git checkout ${WORK_BRANCH} + echo "* Start prow-unit-test-docker *" + chmod ug+x $PWD/upstream-master-ci/prow-unit-test-docker.sh + $PWD/upstream-master-ci/prow-unit-test-docker.sh + rc=$? + [ $rc != 0 ] && echo "ERROR: prow-unit-test-docker exited with code:$rc" + exit $rc + + securityContext: + privileged: true + - name: postsubmit-integration-cli-docker + cluster: k8s-ppc64le-cluster + labels: + preset-build-docker: "true" + decorate: true + decoration_config: + timeout: 2h + run_if_changed: 'job/periodic-config-docker' + reporter_config: + slack: + channel: 'prow-job-notifications' + job_states_to_report: + - failure + - error + report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' + branches: + - prow-job-tracking + spec: + containers: + - image: quay.io/powercloud/docker-ce-build@sha256:b1e2679b9a5aabe15a94ae3130f5b02ce67441cf361fda7dc7a41929bb50ba87 + resources: + requests: + cpu: "4000m" + limits: + cpu: "4000m" + command: + - /bin/bash + args: + - -c + - | + ## + # This job is populated with the files from the 'prow-job-tracking' branch. + # We switch to the 'main' branch, as it contains the scripts used by this job. + ### + + set -o errexit + set -o nounset + set -o pipefail + set -o xtrace + + #Set this to your dev branch for testing + WORK_BRANCH=main + git fetch https://github.com/${REPO_OWNER}/${REPO_NAME} ${WORK_BRANCH} + git checkout ${WORK_BRANCH} + echo "* Start prow-integration-cli-docker *" + chmod ug+x $PWD/upstream-master-ci/prow-integration-cli.sh + $PWD/upstream-master-ci/prow-integration-cli.sh + rc=$? + [ $rc != 0 ] && echo "ERROR: prow-integration-cli-docker exited with code:$rc" + exit $rc + + securityContext: + privileged: true + - name: postsubmit-integration-test-docker + cluster: k8s-ppc64le-cluster + labels: + preset-build-docker: "true" + decorate: true + decoration_config: + timeout: 2h + run_if_changed: 'job/periodic-config-docker' + reporter_config: + slack: + channel: 'prow-job-notifications' + job_states_to_report: + - failure + - error + report_template: 'Job {{.Spec.Job}} of type {{.Spec.Type}} ended with state {{.Status.State}}. <{{.Status.URL}}|View logs>' + branches: + - prow-job-tracking + spec: + containers: + - image: quay.io/powercloud/docker-ce-build@sha256:b1e2679b9a5aabe15a94ae3130f5b02ce67441cf361fda7dc7a41929bb50ba87 + resources: + requests: + cpu: "4000m" + limits: + cpu: "4000m" + command: + - /bin/bash + args: + - -c + - | + ## + # This job is populated with the files from the 'prow-job-tracking' branch. + # We switch to the 'main' branch, as it contains the scripts used by this job. + ### + + set -o errexit + set -o nounset + set -o pipefail + set -o xtrace + + #Set this to your dev branch for testing + WORK_BRANCH=main + git fetch https://github.com/${REPO_OWNER}/${REPO_NAME} ${WORK_BRANCH} + git checkout ${WORK_BRANCH} + echo "* Start prow-integration-test-docker *" + chmod ug+x $PWD/upstream-master-ci/prow-integration-tests.sh + $PWD/upstream-master-ci/prow-integration-tests.sh + rc=$? + [ $rc != 0 ] && echo "ERROR: prow-integration-test-docker exited with code:$rc" + exit $rc + + securityContext: + privileged: true