Skip to content

Commit

Permalink
feat: Initial attempt for CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
jhutar committed Oct 11, 2023
1 parent 1fe301b commit 233320c
Show file tree
Hide file tree
Showing 15 changed files with 504 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
approvers:
- jhutar
- pmacik
options: {}
reviewers:
- jhutar
- pmacik
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
build_root:
image_stream_tag:
name: release
namespace: openshift
tag: golang-1.18
images:
- dockerfile_literal: |-
FROM src
SHELL ["/bin/bash", "-c"]
# Install jq, yq, kubectl, help and vcluster
RUN curl -Lso /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && chmod +x /usr/local/bin/jq
RUN curl -Lso /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.25.2/yq_linux_amd64 && chmod +x /usr/local/bin/yq
RUN curl -Lso /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN yum install -y httpd-tools
RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 700 get_helm.sh && ./get_helm.sh && helm version
RUN curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/download/v0.15.0/vcluster-linux-amd64" && install -c -m 0755 vcluster /usr/local/bin && rm -f vcluster && vcluster --version
from: src
to: pipelines-test-runner
promotion:
name: redhat-appstudio
namespace: ci
releases:
latest:
release:
architecture: amd64
channel: fast
version: "4.12"
resources:
'*':
limits:
cpu: 1000m
memory: 2Gi
requests:
cpu: 1000m
memory: 2Gi
tests:
- as: ocp-pipelines-load-test-ci-test
steps:
cluster_profile: aws
env:
SCENARIO: test
workflow: openshift-pipelines-test-load-test
timeout: 8h0m0s
zz_generated_metadata:
branch: tests-main
org: openshift-pipelines-test
repo: openshift_pipelines_ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
approvers:
- jhutar
- pmacik
options: {}
reviewers:
- jhutar
- pmacik
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
postsubmits:
openshift-pipelines-test/openshift_pipelines_ci:
- agent: kubernetes
always_run: true
branches:
- ^tests-main$
cluster: build03
decorate: true
decoration_config:
skip_cloning: true
labels:
ci-operator.openshift.io/is-promotion: "true"
ci.openshift.io/generator: prowgen
max_concurrency: 1
name: branch-ci-openshift-pipelines-test-openshift_pipelines_ci-tests-main-images
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --image-mirror-push-secret=/etc/push-secret/.dockerconfigjson
- --promote
- --report-credentials-file=/etc/report/credentials
- --target=[images]
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/push-secret
name: push-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: push-secret
secret:
secretName: registry-push-credentials-ci-central
- name: result-aggregator
secret:
secretName: result-aggregator
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
presubmits:
openshift-pipelines-test/openshift_pipelines_ci:
- agent: kubernetes
always_run: true
branches:
- ^tests-main$
- ^tests-main-
cluster: build03
context: ci/prow/images
decorate: true
decoration_config:
skip_cloning: true
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openshift-pipelines-test-openshift_pipelines_ci-tests-main-images
rerun_command: /test 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]
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( | .* )images,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- ^tests-main$
- ^tests-main-
cluster: build05
context: ci/prow/ocp-pipelines-load-test-ci-test
decorate: true
decoration_config:
skip_cloning: true
timeout: 8h0m0s
labels:
ci-operator.openshift.io/cloud: aws
ci-operator.openshift.io/cloud-cluster-profile: aws
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openshift-pipelines-test-openshift_pipelines_ci-tests-main-ocp-pipelines-load-test-ci-test
rerun_command: /test ocp-pipelines-load-test-ci-test
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/ocp-pipelines-load-test-ci-test-cluster-profile
- --target=ocp-pipelines-load-test-ci-test
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/ocp-pipelines-load-test-ci-test-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
- 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( | .* )ocp-pipelines-load-test-ci-test,?($|\s.*)
7 changes: 7 additions & 0 deletions ci-operator/step-registry/openshift-pipelines-test/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
approvers:
- jhutar
- pmacik
options: {}
reviewers:
- jhutar
- pmacik
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
approvers:
- jhutar
- pmacik
options: {}
reviewers:
- jhutar
- pmacik
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

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

TEST=$(cat /usr/local/ci-secrets/redhat-appstudio-load-test/quay-oauth-user)
OPENSHIFT_API="$(yq e '.clusters[0].cluster.server' "$KUBECONFIG")"
OPENSHIFT_USERNAME="kubeadmin"

export OPENSHIFT_PASSWORD
export BYOC_KUBECONFIG

export TEST
export OPENSHIFT_API
export OPENSHIFT_USERNAME

echo -e "[INFO] Start tests with user: ${GITHUB_USER}"

yq -i 'del(.clusters[].cluster.certificate-authority-data) | .clusters[].cluster.insecure-skip-tls-verify=true' "$KUBECONFIG"
if [[ -s "$KUBEADMIN_PASSWORD_FILE" ]]; then
OPENSHIFT_PASSWORD="$(cat "$KUBEADMIN_PASSWORD_FILE")"
elif [[ -s "${SHARED_DIR}/kubeadmin-password" ]]; then
# Recommendation from hypershift qe team in slack channel..
OPENSHIFT_PASSWORD="$(cat "${SHARED_DIR}/kubeadmin-password")"
else
echo "Kubeadmin password file is empty... Aborting job"
exit 1
fi

timeout --foreground 5m bash <<-"EOF"
while ! oc login "$OPENSHIFT_API" -u "$OPENSHIFT_USERNAME" -p "$OPENSHIFT_PASSWORD" --insecure-skip-tls-verify=true; do
sleep 20
done
EOF
if [ $? -ne 0 ]; then
echo "Timed out waiting for login"
exit 1
fi

# Define a new environment for BYOC pointing to a kubeconfig with token. RHTAP environments only supports kubeconfig with token:
# See: https://issues.redhat.com/browse/GITOPSRVCE-554
BYOC_KUBECONFIG="/tmp/token-kubeconfig"
cp "$KUBECONFIG" "$BYOC_KUBECONFIG"
if [[ -s "$BYOC_KUBECONFIG" ]]; then
echo -e "byoc kubeconfig exists!"
else
echo "Kubeconfig not exists in $BYOC_KUBECONFIG... Aborting job"
exit 1
fi

cd "$(mktemp -d)"

git clone --branch main "https://github.com/openshift-pipelines-test/openshift_pipelines_ci.git"

# Collect load test results at the end
trap './ci-scripts/collect-results.sh "$SCENARIO"; trap EXIT' SIGINT EXIT

# Setup Tekton cluster
./ci-scripts/setup-cluster.sh

# Execute load test
./ci-scripts/load-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"path": "openshift-pipelines-test/load-test/openshift-pipelines-test-load-test-ref.yaml",
"owners": {
"approvers": [
"jhutar",
"pmacik"
],
"reviewers": [
"jhutar",
"pmacik"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ref:
as: openshift-pipelines-test-load-test
best_effort: true
grace_period: 300s
cli: latest
timeout: 8h0m0s
commands: openshift-pipelines-test-load-test-commands.sh
env:
- name: SCENARIO
default: "concurrent"
documentation: Load test scenario to execute.
credentials:
- mount_path: /usr/local/ci-secrets/redhat-appstudio-qe
name: ci-secrets
namespace: test-credentials
- mount_path: /usr/local/ci-secrets/redhat-appstudio-load-test
name: rhtap-load-test
namespace: test-credentials
from_image:
name: redhat-appstudio
namespace: ci
tag: e2e-test-runner
resources:
requests:
cpu: 3000m
memory: 6Gi
Loading

0 comments on commit 233320c

Please sign in to comment.