Skip to content

Commit

Permalink
Merge pull request #649 from paigerube14/orion
Browse files Browse the repository at this point in the history
Adding orion jenkins file
  • Loading branch information
paigerube14 authored Oct 17, 2024
2 parents 7f4571d + 3c5f14d commit 835f258
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 61 deletions.
209 changes: 209 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
@Library('flexy') _

// rename build
def userCause = currentBuild.rawBuild.getCause(Cause.UserIdCause)
def upstreamCause = currentBuild.rawBuild.getCause(Cause.UpstreamCause)

userId = "ocp-perfscale-qe"
if (userCause) {
userId = userCause.getUserId()
}
else if (upstreamCause) {
def upstreamJob = Jenkins.getInstance().getItemByFullName(upstreamCause.getUpstreamProject(), hudson.model.Job.class)
if (upstreamJob) {
def upstreamBuild = upstreamJob.getBuildByNumber(upstreamCause.getUpstreamBuild())
if (upstreamBuild) {
def realUpstreamCause = upstreamBuild.getCause(Cause.UserIdCause)
if (realUpstreamCause) {
userId = realUpstreamCause.getUserId()
}
}
}
}
if (userId) {
currentBuild.displayName = userId
}

pipeline {
agent none
options {
timeout(time: 1, unit: 'HOURS')
}
parameters {
string(
name: "UUID",
defaultValue: "",
description: 'UUID of current run to do comparison on'
)
string(
name: "BASELINE_UUID",
defaultValue: "",
description: 'Set a baseline uuid to use for comparison, if blank will find baseline uuid for profile, workload and worker node count to then compare'
)
booleanParam(
name: "PREVIOUS_VERSION",
defaultValue: false,
description: "If you want to compare the current UUID's data to any <ocp-version>-1 release data"
)
booleanParam(
name: "HUNTER_ANALYZE",
defaultValue: false,
description: "If you want to compare the current UUID's data to any <ocp-version>-1 release data"
)
booleanParam(
name: "NODE_COUNT",
defaultValue: false,
description: 'Skip the filtering of uuids that do not match job iterations, should be set to true for any node-density tests'
)
booleanParam(
name: "CMR",
defaultValue: true,
description: 'Skip the filtering of uuids that do not match job iterations, should be set to true for any node-density tests'
)
booleanParam(
name: "INTERNAL_ES",
defaultValue: false,
description: 'Find matching data in the internal instance'
)
string(
name: "CONFIG",
defaultValue: "examples/small-scale-cluster-density.yaml",
description: '''Set of time to look back at to find any comparable results
<a href="https://github.com/cloud-bulldozer/orion/tree/main/examples"> Example configs here </a>
'''
)
text(name: 'ENV_VARS', defaultValue: '', description:'''<p>
Enter list of additional (optional) Env Vars you'd want to pass to the script, one pair on each line. <br>
e.g.<br>
SOMEVAR1='env-test'<br>
SOMEVAR2='env2-test'<br>
...<br>
SOMEVARn='envn-test'<br>
</p>'''
)
string(name:'JENKINS_AGENT_LABEL',defaultValue:'oc416',description:
'''
scale-ci-static: for static agent that is specific to scale-ci, useful when the jenkins dynamic agen
isn't stable<br>
4.y: oc4y || mac-installer || rhel8-installer-4y <br/>
e.g, for 4.8, use oc48 || mac-installer || rhel8-installer-48 <br/>
3.11: ansible-2.6 <br/>
3.9~3.10: ansible-2.4 <br/>
3.4~3.7: ansible-2.4-extra || ansible-2.3 <br/>
'''
)
string(
name: 'ORION_REPO',
defaultValue:'https://github.com/cloud-bulldozer/orion.git',
description:'You can change this to point to your fork if needed.'
)
string(
name: 'ORION_REPO_BRANCH',
defaultValue:'main',
description:'You can change this to point to a branch on your fork if needed.'
)
}

stages {

stage('Run Orion Comparison'){
agent { label params['JENKINS_AGENT_LABEL'] }
steps{

deleteDir()

checkout([
$class: 'GitSCM',
branches: [[name: GIT_BRANCH ]],
doGenerateSubmoduleConfigurations: false,
userRemoteConfigs: [[url: GIT_URL ]
]])
checkout([
$class: 'GitSCM',
branches: [[name: params.ORION_REPO_BRANCH ]],
doGenerateSubmoduleConfigurations: false,
extensions: [
[$class: 'CloneOption', noTags: true, reference: '', shallow: true],
[$class: 'PruneStaleBranch'],
[$class: 'CleanCheckout'],
[$class: 'IgnoreNotifyCommit'],
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'orion']
],
userRemoteConfigs: [[url: params.ORION_REPO ]]
])

script{
env.EMAIL_ID_FOR_RESULTS_SHEET = "${userId}@redhat.com"
withCredentials([usernamePassword(credentialsId: 'elasticsearch-perfscale-ocp-qe', usernameVariable: 'ES_USERNAME', passwordVariable: 'ES_PASSWORD'),
usernamePassword(credentialsId: 'elasticsearch-perfscale-ocp-internal', usernameVariable: 'ES_USERNAME_INTERNAL', passwordVariable: 'ES_PASSWORD_INTERNAL'),
file(credentialsId: 'sa-google-sheet', variable: 'GSHEET_KEY_LOCATION')]) {
RETURNSTATUS = sh(returnStatus: true, script: '''
# Get ENV VARS Supplied by the user to this job and store in .env_override
echo "$ENV_VARS" > .env_override
# Export those env vars so they could be used by CI Job
set -a && source .env_override && set +a
if [[ $INTERNAL_ES == "true" ]]; then
n=${#ES_PASSWORD_INTERNAL}
export ES_SERVER="https://$ES_USERNAME_INTERNAL:[email protected]"
n=${#ES_SERVER}
echo "internal $n"
export es_metadata_index="ospst-perf-scale-ci*"
export es_benchmark_index="ospst-ripsaw-kube-burner*"
else
echo "qe"
export es_metadata_index="perf_scale_ci*"
export es_benchmark_index="ripsaw-kube-burner*"
export ES_SERVER="https://$ES_USERNAME:$ES_PASSWORD@search-ocp-qe-perf-scale-test-elk-hcm7wtsqpxy7xogbu72bor4uve.us-east-1.es.amazonaws.com"
fi
python3.9 --version
python3.9 -m pip install virtualenv
python3.9 -m virtualenv venv3
source venv3/bin/activate
python --version
cd orion
pip install -r requirements.txt
pip install .
extra_vars=""
if [[ $HUNTER_ANALYZE == "true" ]]; then
extra_vars=" --hunter-analyze"
fi
if [[ $NODE_COUNT == "true" ]]; then
extra_vars+=" --node-count True"
fi
if [[ $CMR == "true" ]]; then
extra_vars+=" --cmr"
fi
if [[ -n $UUID ]]; then
extra_vars+=" --uuid $UUID"
fi
if [[ -n $BASELINE_UUID ]]; then
extra_vars+=" --baseline $BASELINE_UUID"
fi
orion cmd --config $CONFIG --debug$extra_vars
pwd
''')
if (RETURNSTATUS.toInteger() != 0) {
currentBuild.result = "FAILURE"
}
archiveArtifacts(
artifacts: 'orion/output*.*',
allowEmptyArchive: true,
fingerprint: true
)
archiveArtifacts(
artifacts: 'orion/data*.*',
allowEmptyArchive: true,
fingerprint: true
)
}
}
}

}
}
}
4 changes: 1 addition & 3 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ approvers:
- mffiedler
- qiliRedHat
- paigerube14
- jtaleric
- svetsa-rh
reviewers:
- qiliRedHat
Expand All @@ -11,5 +10,4 @@ reviewers:
- rpattath
- skordas
- memodi
- jtaleric
- svetsa-rh
- svetsa-rh
60 changes: 2 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,3 @@
# ocp-qe-perfscale-ci
# Orion

## Purpose
This repo contains various `Jenkinsfile` and other pertaining content that are used by a multi-branch pipeline in the OCP QE Jenkins instance.

## Structure
There are multiple orphan branches present in this repos, each of them are supposed to house one kind of workload for [E2E-benchmarking](https://github.com/cloud-bulldozer/e2e-benchmarking/). Each branch should contain one `Jenkinsfile`

You can create a new orphan branch simply by `git checkout --orphan BRANCHNAME` for new workload.

The OCP QE Jenkins multi-branch pipeline job will look at the `Jenkinsfile` on each of these branches and create a new workload job for you to execute in your Jenkins.

This repository also hosting the `perf-dashboard-grafana-crs` directory, that includes all the Custom Resources and relevant files that you need to deploy a fully functional perf-scale dashboard. This deployment uses grafana operator to enable grafana operator on your cluster, create an instance, create required datasources(in this case Prometheus and ElasticSearch) and dashboards.

See `launch-grafana.sh` for env variables that are needed. `cleanup-grafana.sh` can be used to clean up everything created by the `launch-grafana.sh` script.

**PREREQUISITE:** is to have `KUBECONFIG` env variable configured that can access your OpenShift cluster.

## Jobs
This is an overview - for additional details about each job, see the respective `README` in the specific branch for that job. Note that some jobs may call others.

| Job | Purpose |
| --- | --- |
| benchmark-cleaner | TODO |
| benchmark-comparison | TODO |
| cerberus | TODO |
| chaos-upgrade | TODO |
| cluster-builder | TODO |
| cluster-post-config | TODO |
| cluster-workers-scaling | TODO |
| etcd-perf | TODO |
| kraken | TODO |
| kube-burner | TODO |
| kube-burner-ocp | TODO |
| loaded-upgrade | TODO |
| must-gather | TODO |
| netobserv-perf-tests | Used for Performance and Scale testing of the Network Observability Operator |
| network-perf | TODO |
| network-perf-v2 | TODO |
| post-results-to-es | TODO |
| post-to-slack | TODO |
| regression-test | TODO |
| router-perf | TODO |
| upgrade | TODO |
| write-scale-ci-results | TODO |

## Scripts

### Mr. Sandman
Sometimes, the only way to get data such as UUID and workload timestamp information is directly from the workload job runs. If you find yourself in need of this but don't want to manually pour through logs, you can let Mr. Sandman give it a shot by running `./scripts/sandman.py --file <path/to/out/file>`

By default he will output a JSON of data to `./data/workload.json` but you can also output a Shell file for use in BASH environment using the `--output sh` flag

## Authors
Kedar Kulkarni <@kedark3 on Github>

Paige Rubendall <@paigerube14 on Github>

Nathan Weinberg <@nathan-weinberg on GitHub>
https://github.com/cloud-bulldozer/orion.git

0 comments on commit 835f258

Please sign in to comment.