Skip to content

Commit

Permalink
Add presubmit jobs on pull request checking for rosacli (#51427)
Browse files Browse the repository at this point in the history
update

update

update

update

update

update

update

update

update
  • Loading branch information
yasun1 committed May 11, 2024
1 parent a8e7d48 commit 0befaf5
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
base_images:
cli-ocm:
name: cli-ocm
namespace: ci
tag: latest
ocp_builder_rhel-8-golang-1.21-openshift-4.16:
name: builder
namespace: ocp
tag: rhel-8-golang-1.21-openshift-4.16
origin_4.16_cli:
name: "4.16"
namespace: origin
tag: cli
build_root:
image_stream_tag:
name: builder
namespace: ocp
tag: rhel-8-golang-1.21-openshift-4.16
images:
- dockerfile_path: images/Dockerfile.e2e
from: origin_4.16_cli
inputs:
cli-ocm:
as:
- registry.ci.openshift.org/ci/cli-ocm:latest
ocp_builder_rhel-8-golang-1.21-openshift-4.16:
as:
- registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.21-openshift-4.16
to: rosa-aws-cli
releases:
latest:
integration:
name: "4.16"
namespace: ocp
resources:
'*':
requests:
cpu: 150m
memory: 300Mi
tests:
- always_run: false
as: pr-rosa-hcp
optional: true
steps:
cluster_profile: aws-sd-qe
env:
ENABLE_AUTOSCALING: "true"
MAX_REPLICAS: "6"
MIN_REPLICAS: "3"
TEST_LABEL_FILTERS: (day1-post,day2)&&!NonHCPCluster&&!Exclude
test:
- ref: rosa-test-e2e-pull-request
workflow: rosa-aws-sts-hcp-byo-kms-oidc-auditlog
zz_generated_metadata:
branch: master
org: openshift
repo: rosa
variant: e2e-presubmits
140 changes: 140 additions & 0 deletions ci-operator/jobs/openshift/rosa/openshift-rosa-master-presubmits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,146 @@ presubmits:
secret:
secretName: rosa-codecov-token
trigger: (?m)^/test( | .* )coverage,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- ^master$
- ^master-
cluster: build04
context: ci/prow/e2e-presubmits-images
decorate: true
decoration_config:
skip_cloning: true
labels:
ci-operator.openshift.io/variant: e2e-presubmits
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openshift-rosa-master-e2e-presubmits-images
rerun_command: /test e2e-presubmits-images
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=[images]
- --variant=e2e-presubmits
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /secrets/manifest-tool
name: manifest-tool-local-pusher
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: manifest-tool-local-pusher
secret:
secretName: manifest-tool-local-pusher
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )e2e-presubmits-images,?($|\s.*)
- agent: kubernetes
always_run: false
branches:
- ^master$
- ^master-
cluster: build05
context: ci/prow/e2e-presubmits-pr-rosa-hcp
decorate: true
decoration_config:
skip_cloning: true
labels:
ci-operator.openshift.io/cloud: aws
ci-operator.openshift.io/cloud-cluster-profile: aws-sd-qe
ci-operator.openshift.io/variant: e2e-presubmits
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openshift-rosa-master-e2e-presubmits-pr-rosa-hcp
optional: true
rerun_command: /test e2e-presubmits-pr-rosa-hcp
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --lease-server-credentials-file=/etc/boskos/credentials
- --report-credentials-file=/etc/report/credentials
- --secret-dir=/secrets/ci-pull-credentials
- --secret-dir=/usr/local/pr-rosa-hcp-cluster-profile
- --target=pr-rosa-hcp
- --variant=e2e-presubmits
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /etc/boskos
name: boskos
readOnly: true
- mountPath: /secrets/ci-pull-credentials
name: ci-pull-credentials
readOnly: true
- mountPath: /usr/local/pr-rosa-hcp-cluster-profile
name: cluster-profile
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /secrets/manifest-tool
name: manifest-tool-local-pusher
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: boskos
secret:
items:
- key: credentials
path: credentials
secretName: boskos-credentials
- name: ci-pull-credentials
secret:
secretName: ci-pull-credentials
- name: cluster-profile
secret:
secretName: cluster-secrets-aws-sd-qe
- name: manifest-tool-local-pusher
secret:
secretName: manifest-tool-local-pusher
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )e2e-presubmits-pr-rosa-hcp,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM

log(){
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}"
}

TEST_LABEL_FILTERS=${TEST_LABEL_FILTERS:-}
CLUSTER_ID=$(cat "${SHARED_DIR}/cluster-id")
log "Working on the cluster: $CLUSTER_ID"
export CLUSTER_ID # maybe we should get cluster_id by TEST_PROFILE


# Configure aws
REGION=${REGION:-${LEASED_RESOURCE}}
AWSCRED="${CLUSTER_PROFILE_DIR}/.awscred"
export AWS_SHARED_CREDENTIALS_FILE="${AWSCRED}"
export AWS_DEFAULT_REGION="${REGION}"

# Log in
OCM_TOKEN=$(cat "${CLUSTER_PROFILE_DIR}/ocm-token")
rosa login --env "${OCM_LOGIN_ENV}" --token "${OCM_TOKEN}"

# Variables
COMMIT_FOCUS="/rosa/tests/ci/data/commit-focus"
FOCUS=$(cat "${COMMIT_FOCUS}")
FOCUS_LABEL_FILTER=""
FOCUS_SWITCH="--ginkgo.focus ${FOCUS}"
if [[ -z "$FOCUS" ]]; then
echo "Warning: No TC updated, focus on Critial"
FOCUS_LABEL_FILTER="Critical"
FOCUS_SWITCH=""
fi

LABEL_FILTER_SWITCH=""
if [[ ! -z "$FOCUS_LABEL_FILTER" ]]; then
if [[ -z "$TEST_LABEL_FILTERS" ]]; then
TEST_LABEL_FILTERS=${FOCUS_LABEL_FILTER}
else
TEST_LABEL_FILTERS="${TEST_LABEL_FILTERS}&&$FOCUS_LABEL_FILTER"
fi
fi
if [[ ! -z "$TEST_LABEL_FILTERS" ]]; then
echo "Label Filter: $TEST_LABEL_FILTERS"
LABEL_FILTER_SWITCH="--ginkgo.label-filter ${TEST_LABEL_FILTERS}"
fi

log "INFO: Start pull reqeust testing ..."
rosatest --ginkgo.v --ginkgo.no-color ${FOCUS_SWITCH} ${LABEL_FILTER_SWITCH}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"path": "rosa/test/e2e/pull-request/rosa-test-e2e-pull-request-ref.yaml",
"owners": {
"approvers": [
"yasun1",
"xueli181114",
"yuwang-RH",
"yufchang",
"jtaleric",
"svetsa-rh",
"radtriste"
],
"reviewers": [
"yasun1",
"xueli181114",
"yuwang-RH",
"tzhou5",
"yingzhanredhat",
"yufchang",
"jtaleric",
"svetsa-rh",
"radtriste"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ref:
as: rosa-test-e2e-pull-request
from: rosa-aws-cli
grace_period: 10m
commands: rosa-test-e2e-pull-request-commands.sh
resources:
requests:
cpu: 100m
memory: 300Mi
env:
- name: OCM_LOGIN_ENV
default: "staging"
documentation: The environment for rosa login. The supported values are [production, staging, integration].
- name: REGION
default: ""
documentation: Use a specific AWS region, overriding the LEASED_RESOURCE environment variable in the cluster_profile.
- name: TEST_LABEL_FILTERS
default: ""
documentation: The filters for picking up the test scenarios.

documentation: |-
Do rosacli pull request presubmit testing .

0 comments on commit 0befaf5

Please sign in to comment.