-
Notifications
You must be signed in to change notification settings - Fork 79
Add ability to test PRs from kube-burner-ocp repositories instead of only using release versions #816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sraviteja-maker
wants to merge
8
commits into
cloud-bulldozer:master
Choose a base branch
from
sraviteja-maker:kubeburner_ocp_pr_testing
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add ability to test PRs from kube-burner-ocp repositories instead of only using release versions #816
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2f5c7a9
Add ability to test PRs from kube-burner-ocp repositories instead of …
sraviteja-maker 90338af
Updated GIT global user settings to rectify pull with rebase errors
sraviteja-maker fa027ad
Updated GIT Global user settings in run.sh as well to test through PR…
sraviteja-maker 21d2bd1
Add automatic Go installation with version checking
sraviteja-maker b871fc1
Removed the git config global user settings
sraviteja-maker 566ece7
Use fetch and rebase flow for PR cloning
sraviteja-maker 4c0e104
Reverted the git config global user settings and PR Cloning method
sraviteja-maker da45c7d
Updated the proper values for GIT global user settings
sraviteja-maker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,9 @@ fi | |
| KUBE_BURNER_VERSION=${KUBE_BURNER_VERSION:-1.8.0} | ||
| OS=$(uname -s) | ||
| HARDWARE=$(uname -m) | ||
| # Detect architecture for different use cases | ||
| BIN_ARCH=${BIN_ARCH:-$(uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/)} | ||
| GO_ARCH=${GO_ARCH:-$(uname -s | awk '{print tolower($0)}')-${BIN_ARCH}} | ||
| PERFORMANCE_PROFILE=${PERFORMANCE_PROFILE:-default} | ||
| CHURN=${CHURN:-true} | ||
| WORKLOAD=${WORKLOAD:?} | ||
|
|
@@ -21,12 +24,78 @@ EXTRA_FLAGS=${EXTRA_FLAGS:-} | |
| UUID=${UUID:-$(uuidgen)} | ||
| KUBE_DIR=${KUBE_DIR:-/tmp} | ||
| ES_INDEX=${ES_INDEX:-ripsaw-kube-burner} | ||
| KUBEBURNER_OCP_PR=${KUBEBURNER_OCP_PR:-} | ||
| GO_VERSION=${GO_VERSION:-1.23.4} | ||
|
|
||
| download_binary(){ | ||
| KUBE_BURNER_URL="https://github.com/kube-burner/kube-burner-ocp/releases/download/v${KUBE_BURNER_VERSION}/kube-burner-ocp-V${KUBE_BURNER_VERSION}-${OS}-${HARDWARE}.tar.gz" | ||
| curl --fail --retry 8 --retry-all-errors -sS -L "${KUBE_BURNER_URL}" | tar -xzC "${KUBE_DIR}/" kube-burner-ocp | ||
| } | ||
|
|
||
| install_go(){ | ||
| INSTALL_GO=false | ||
|
|
||
| # Check if go is installed | ||
| if ! command -v go &> /dev/null; then | ||
| echo "Go is not installed. Installing Go ${GO_VERSION}..." | ||
| INSTALL_GO=true | ||
| else | ||
| # Check if installed version is sufficient | ||
| INSTALLED_GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//') | ||
| REQUIRED_GO_VERSION="${GO_VERSION}" | ||
|
|
||
| if [ "$(printf '%s\n' "$REQUIRED_GO_VERSION" "$INSTALLED_GO_VERSION" | sort -V | head -n1)" != "$REQUIRED_GO_VERSION" ]; then | ||
| echo "Go version $INSTALLED_GO_VERSION is too old (requires >= $REQUIRED_GO_VERSION). Installing Go ${GO_VERSION}..." | ||
| INSTALL_GO=true | ||
| else | ||
| echo "Go version $INSTALLED_GO_VERSION is sufficient." | ||
| fi | ||
| fi | ||
|
|
||
| if [ "$INSTALL_GO" = true ]; then | ||
| GO_TARBALL="go${GO_VERSION}.${GO_ARCH}.tar.gz" | ||
| curl -L https://go.dev/dl/${GO_TARBALL} -o ${GO_TARBALL} | ||
| tar -C ${KUBE_DIR}/ -xzf ${GO_TARBALL} | ||
| export PATH=${KUBE_DIR}/go/bin:$PATH | ||
| rm -f ${GO_TARBALL} | ||
| echo "Go ${GO_VERSION} installed successfully." | ||
| fi | ||
| } | ||
|
|
||
| build_from_pr(){ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move this function to a different bash file?, I'd like to keep this one as simple as possible. |
||
| echo "Building kube-burner-ocp from PR #${KUBEBURNER_OCP_PR}" | ||
| install_go | ||
| # Clone the repository | ||
| REPO_DIR="${KUBE_DIR}/kube-burner-ocp-repo" | ||
| if [ -d "${REPO_DIR}" ]; then | ||
| rm -rf "${REPO_DIR}" | ||
| fi | ||
|
|
||
| git clone https://github.com/kube-burner/kube-burner-ocp.git "${REPO_DIR}" | ||
| cd "${REPO_DIR}" | ||
|
|
||
| # Update GIT Global user settings | ||
| git config --global user.name "RedHat Performance" | ||
| git config --global user.email "[email protected]" | ||
|
|
||
| # Fetch the PR and checkout | ||
| git pull origin pull/${KUBEBURNER_OCP_PR}/head:${KUBEBURNER_OCP_PR} --rebase | ||
| git switch ${KUBEBURNER_OCP_PR} | ||
|
|
||
| # Build the binary | ||
| echo "Building binary..." | ||
| make build | ||
|
|
||
| # Copy the binary to KUBE_DIR | ||
| cp bin/${BIN_ARCH}/kube-burner-ocp "${KUBE_DIR}/kube-burner-ocp" | ||
| chmod +x "${KUBE_DIR}/kube-burner-ocp" | ||
|
|
||
| # Return to original directory | ||
| cd - | ||
|
|
||
| echo "Successfully built kube-burner-ocp from PR #${KUBEBURNER_OCP_PR}" | ||
| } | ||
|
|
||
| hypershift(){ | ||
| echo "HyperShift detected" | ||
|
|
||
|
|
@@ -124,7 +193,13 @@ EOF | |
|
|
||
| } | ||
|
|
||
| download_binary | ||
| # Build from PR if KUBEBURNER_OCP_PR is set, otherwise download binary | ||
| if [[ -n ${KUBEBURNER_OCP_PR} ]]; then | ||
| build_from_pr | ||
| else | ||
| download_binary | ||
| fi | ||
|
|
||
| if [[ ${WORKLOAD} =~ "index" ]]; then | ||
| cmd="${KUBE_DIR}/kube-burner-ocp index --uuid=${UUID} --start=$START_TIME --end=$((END_TIME+600)) --log-level ${LOG_LEVEL}" | ||
| JOB_START=$(date -u -d "@$START_TIME" +"%Y-%m-%dT%H:%M:%SZ") | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing golang should be out of scope of this repository, we don't usually do modifications in the local environment where these scripts run