-
Notifications
You must be signed in to change notification settings - Fork 42
First commit for upgrade #1368
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
base: main
Are you sure you want to change the base?
First commit for upgrade #1368
Changes from 6 commits
548db5d
33cfefa
f0ebc6b
93b1480
480d5eb
c8baf28
0775550
e9b340c
ab6e2be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,160 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Upgrade CI test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - main | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| push: # Runs on any direct push to any branch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| k8s: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout tackle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repository: konveyor/tackle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: tackle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout to branch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Get Initial Branch Name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: echo "INIT_BRANCH=$(git symbolic-ref --short HEAD)" >> $GITHUB_ENV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install operator-sdk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if command -v operator-sdk >/dev/null 2>&1; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "operator-sdk is already installed...yay" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.35.0/operator-sdk_linux_amd64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo install -o root -g root -m 0755 operator-sdk_linux_amd64 /usr/local/bin/operator-sdk | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install kubectl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if command -v kubectl >/dev/null 2>&1; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "kubectl is already installed...yay" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install operator-sdk | |
| shell: bash | |
| run: | | |
| if command -v operator-sdk >/dev/null 2>&1; then | |
| echo "operator-sdk is already installed...yay" | |
| exit 0 | |
| fi | |
| curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.35.0/operator-sdk_linux_amd64 | |
| sudo install -o root -g root -m 0755 operator-sdk_linux_amd64 /usr/local/bin/operator-sdk | |
| - name: Install kubectl | |
| shell: bash | |
| run: | | |
| if command -v kubectl >/dev/null 2>&1; then | |
| echo "kubectl is already installed...yay" | |
| exit 0 | |
| fi | |
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
| sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
| - name: Install operator-sdk | |
| shell: bash | |
| run: | | |
| if command -v operator-sdk >/dev/null 2>&1; then | |
| echo "operator-sdk is already installed...yay" | |
| exit 0 | |
| fi | |
| curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.35.0/operator-sdk_linux_amd64 | |
| echo "f0b0e... operator-sdk_linux_amd64" | sha256sum -c - | |
| sudo install -o root -g root -m 0755 operator-sdk_linux_amd64 /usr/local/bin/operator-sdk | |
| - name: Install kubectl | |
| shell: bash | |
| run: | | |
| if command -v kubectl >/dev/null 2>&1; then | |
| echo "kubectl is already installed...yay" | |
| exit 0 | |
| fi | |
| curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
| sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl |
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml between lines 26 and 45, the download steps
for operator-sdk and kubectl lack checksum verification, posing a supply-chain
risk. To fix this, add SHA256 checksum verification after downloading each
binary by fetching the official checksum file or hardcoding the expected
checksum, then verify the downloaded file's integrity before running the install
command. Apply the same checksum verification process for both operator-sdk and
kubectl binaries.
Outdated
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.
🛠️ Refactor suggestion
Mirror the same checksum guard for kubectl
Add integrity verification before sudo install, exactly as recommended for operator-sdk.
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml around lines 36 to 45, the kubectl
installation step lacks a checksum verification before installing the binary. To
fix this, add a checksum download and verification step similar to the
operator-sdk installation, ensuring the kubectl binary's integrity before
running the sudo install command. This involves downloading the checksum file,
verifying the kubectl binary against it, and only proceeding with installation
if the checksum matches.
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.
🛠️ Refactor suggestion
Extend checksum/sig verification to the opm binary
The OPM CLI is fetched from GitHub and installed with root privileges, yet no integrity check is performed.
Add a SHA-256 (or GPG) verification step before mv.
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml around lines 53 to 59, the script downloads
the opm binary and installs it with root privileges but lacks integrity
verification. To fix this, add a step to download the corresponding SHA-256
checksum or GPG signature file for the opm binary, then verify the downloaded
binary against this checksum or signature before moving it to /usr/local/bin. If
the verification fails, the script should abort to prevent installing a
potentially tampered binary.
Outdated
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.
🛠️ Refactor suggestion
Avoid echoing secrets in logs – set them via env: instead
Even though GitHub masks secret values, writing them to the log with echo is unnecessary and a potential foot-gun. Prefer the built-in env: map:
- name: Set Quay credentials
env:
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
run: echo "Quay creds injected via environment"This keeps logs clean and removes an extra file write to $GITHUB_ENV.
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml around lines 61 to 65, avoid echoing secrets
into the logs by removing the echo commands that write QUAY_USERNAME and
QUAY_PASSWORD to $GITHUB_ENV. Instead, set these secrets directly using the env:
map in the step definition to inject them as environment variables securely
without writing to files or logs.
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.
run : is invalid YAML – the job will fail to parse
The extra space before the colon makes the key run invalid.
- - name: Enable ingress addon
- run : minikube addons enable ingress
+ - name: Enable ingress addon
+ run: minikube addons enable ingress📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Enable ingress addon | |
| run : minikube addons enable ingress | |
| - name: Enable ingress addon | |
| run: minikube addons enable ingress |
🧰 Tools
🪛 YAMLlint (1.37.1)
[warning] 79-79: too many spaces before colon
(colons)
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml at lines 78 to 80, the key `run` has an
extra space before the colon, making it invalid YAML syntax. Remove the space
before the colon so it reads `run:` instead of `run :` to fix the YAML parsing
error.
Outdated
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.
kubectl get ingress … --template is wrong and loop can spin forever
kubectluses-o go-template='…'or-o jsonpath=; the--templateflag is invalid and the command exits non-zero, so$external_ipis always empty ⇒ infinite loop.- Variables are unquoted (SC2086) and there is no timeout.
Suggested fix:
- external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] &&
+ external_ip=$(kubectl get ingress tackle -n konveyor-tackle \
+ -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null) ||
+ true
+ [[ -z "$external_ip" ]] &&And wrap the loop with a timeout, e.g. end=$((SECONDS+300)) …
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| while [[ -z $external_ip ]] | |
| do | |
| echo "Waiting for end point..." | |
| external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] && | |
| echo $external_ip; | |
| while [[ -z $external_ip ]] | |
| do | |
| echo "Waiting for end point..." | |
| external_ip=$(kubectl get ingress tackle -n konveyor-tackle \ | |
| -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null) || true | |
| [[ -z "$external_ip" ]] && echo $external_ip; |
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 100-100: trailing spaces
(trailing-spaces)
[error] 101-101: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml around lines 100 to 104, the kubectl command
incorrectly uses the invalid --template flag causing it to fail and the loop to
spin forever. Replace --template with the correct -o go-template flag and quote
all variable expansions to avoid word splitting issues. Additionally, add a
timeout mechanism to the loop by setting an end time (e.g.,
end=$((SECONDS+300))) and break the loop if the timeout is reached to prevent
infinite looping.
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.
🛠️ Refactor suggestion
Use the resolved ingress IP instead of Minikube’s node IP
You work hard to poll external_ip but then ignore it:
- export endpoint=$(minikube ip);
- echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV'
+ endpoint="$external_ip"
+ echo "CYPRESS_tackleUrl=https://$endpoint" >>"$GITHUB_ENV"This ensures tests hit the actual ingress rather than the node-IP, which may not route correctly with ingress enabled.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export endpoint=$(minikube ip); | |
| echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV' | |
| endpoint="$external_ip" | |
| echo "CYPRESS_tackleUrl=https://$endpoint" >>"$GITHUB_ENV" |
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml at lines 111-112, replace the use of
Minikube's node IP with the resolved ingress IP by using the previously polled
`external_ip` variable instead of calling `minikube ip`. Update the export line
to assign `endpoint` to the `external_ip` value so that the tests target the
ingress IP, ensuring correct routing through ingress.
Outdated
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.
🛠️ Refactor suggestion
Wait for Ingress loop can hang forever & misses quoting
The while-loop lacks a timeout and uses unquoted variable expansions flagged by ShellCheck (SC2086). A safer, bounded version:
-run: |
- bash -c 'external_ip="";
- ...
- while [[ -z $external_ip ]]
- do
- ...
- done
- ...
- echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV'
+run: |
+ set -eo pipefail
+ timeout=300 # 5 min
+ end=$((SECONDS+timeout))
+ while [[ -z "${external_ip:-}" && $SECONDS -lt $end ]]; do
+ echo "Waiting for ingress…"
+ external_ip=$(kubectl get ingress tackle -n konveyor-tackle \
+ --template='{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}')
+ sleep 10
+ done
+ [[ -z $external_ip ]] && { echo "::error::Ingress not ready in ${timeout}s"; exit 1; }
+ echo "Ingress IP: $external_ip"
+ echo "CYPRESS_tackleUrl=https://$(minikube ip)" >> "$GITHUB_ENV"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Wait for Ingress | |
| shell: bash | |
| run: | | |
| bash -c 'external_ip=""; | |
| echo $external_ip; | |
| while [[ -z $external_ip ]] | |
| do | |
| echo "Waiting for end point..." | |
| external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] && | |
| echo $external_ip; | |
| sleep 10; | |
| done | |
| echo "End point ready:" && | |
| echo $external_ip; | |
| export endpoint=$(minikube ip); | |
| echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV' | |
| git branch | |
| - name: Wait for Ingress | |
| shell: bash | |
| run: | | |
| set -eo pipefail | |
| timeout=300 # 5 min | |
| end=$((SECONDS + timeout)) | |
| while [[ -z "${external_ip:-}" && SECONDS -lt end ]]; do | |
| echo "Waiting for ingress…" | |
| external_ip=$(kubectl get ingress tackle \ | |
| -n konveyor-tackle \ | |
| --template='{{range .status.loadBalancer.ingress}}{{.ip}}{{end}}') | |
| sleep 10 | |
| done | |
| [[ -z $external_ip ]] && { | |
| echo "::error::Ingress not ready in ${timeout}s" | |
| exit 1 | |
| } | |
| echo "Ingress IP: $external_ip" | |
| echo "CYPRESS_tackleUrl=https://$(minikube ip)" >> "$GITHUB_ENV" | |
| git branch |
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 103-103: trailing spaces
(trailing-spaces)
[error] 104-104: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents
In .github/workflows/upgrade-ci.yml between lines 98 and 114, the 'Wait for
Ingress' step's while-loop can hang indefinitely and uses unquoted variable
expansions, which is unsafe. To fix this, add a timeout counter to break the
loop after a reasonable number of attempts, and quote all variable expansions
like "$external_ip" to prevent word splitting and globbing issues. This ensures
the loop terminates and the script is more robust.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,20 @@ | ||||||
| #!/bin/bash | ||||||
|
|
||||||
| set -E | ||||||
| set -e | ||||||
| set -x | ||||||
| set -o pipefail | ||||||
|
|
||||||
| SOURCE_UPGRADE_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-quay.io/konveyor/tackle2-operator-bundle:v0.6.0}" | ||||||
| TARGET_UPGRADE_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-quay.io/konveyor/tackle2-operator-bundle:latest}" | ||||||
|
||||||
|
|
||||||
| echo 'Creating bundle image using $SOURCE_UPGRADE_BUNDLE_IMAGE and $TARGET_UPGRADE_BUNDLE_IMAGE' | ||||||
|
||||||
| echo 'Creating bundle image using $SOURCE_UPGRADE_BUNDLE_IMAGE and $TARGET_UPGRADE_BUNDLE_IMAGE' | |
| echo "Creating bundle image using ${SOURCE_UPGRADE_BUNDLE_IMAGE} and ${TARGET_UPGRADE_BUNDLE_IMAGE}" |
🤖 Prompt for AI Agents
In hack/create-index-image.sh at line 11, the echo statement uses single quotes
which prevent variable expansion. Change the single quotes to double quotes so
that $SOURCE_UPGRADE_BUNDLE_IMAGE and $TARGET_UPGRADE_BUNDLE_IMAGE are expanded
and their values are printed in the log.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| NAMESPACE="${NAMESPACE:-konveyor-tackle}" | ||
| TEMPLATE_DIR="${TEMPLATE_DIR:-hack/templates}" | ||
| KONVEYOR_UPGRADE_INDEX="${KONVEYOR_UPGRADE_INDEX:-quay.io/migqe/tackle2-operator-upgrade-index:latest}" | ||
|
Comment on lines
+1
to
+3
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. Add a proper she-bang and fail-fast flags Without a she-bang the script inherits +#!/usr/bin/env bash
+set -euo pipefail
NAMESPACE="${NAMESPACE:-konveyor-tackle}"
TEMPLATE_DIR="${TEMPLATE_DIR:-hack/templates}"
KONVEYOR_UPGRADE_INDEX="${KONVEYOR_UPGRADE_INDEX:-quay.io/migqe/tackle2-operator-upgrade-index:latest}"🧰 Tools🪛 Shellcheck (0.10.0)[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. (SC2148) 🤖 Prompt for AI Agents |
||
| SUBSCRIPTION_CHANNEL="${SUBSCRIPTION_CHANNEL:-development}" | ||
| PREUPGRADE_VERSION="${PREUPGRADE_VERSION:-0.6.0}" | ||
| POSTUPGRADE_VERSION="${POSTUPGRADE_VERSION:-99.0.0}" #Always the latest from main. | ||
| TIMEOUT=300 # Maximum wait time in seconds (5 minutes) | ||
| INTERVAL=10 # Time to wait between checks (10 seconds) | ||
| ELAPSED=0 | ||
|
|
||
|
|
||
| echo "Patch subscription channel to ${SUBSCRIPTION_CHANNEL}" | ||
| kubectl patch sub konveyor-operator -n konveyor-tackle --type=merge -p "{\"spec\":{\"channel\":\"${SUBSCRIPTION_CHANNEL}\"}}" | ||
|
|
||
|
Comment on lines
+13
to
+14
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. 🛠️ Refactor suggestion Hard-coded namespace ignores the configurable -kubectl patch sub konveyor-operator -n konveyor-tackle --type=merge -p "{\"spec\":{\"channel\":\"${SUBSCRIPTION_CHANNEL}\"}}"
+kubectl patch sub konveyor-operator -n "${NAMESPACE}" --type=merge \
+ -p "{\"spec\":{\"channel\":\"${SUBSCRIPTION_CHANNEL}\"}}"🤖 Prompt for AI Agents |
||
| echo "Patching installplan for konveyor..." | ||
|
|
||
| kubectl patch ip $(kubectl get ip -n "${NAMESPACE}" | egrep "$POSTUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' | ||
|
|
||
| kubectl wait --namespace "${NAMESPACE}" --for=condition=Successful --timeout=600s tackles.tackle.konveyor.io/tackle | ||
|
|
||
| kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=tackle-ui -n "${NAMESPACE}" --timeout=300s | ||
|
|
||
| echo "Waiting for UI pod to be replaced after upgrade..." | ||
| echo "Previous UI Pod: $PREUPGRADE_UI_POD" | ||
|
|
||
| while true; do | ||
| # Get the current UI pod name | ||
| UI_POD_AFTER=$(kubectl get pods -n "${NAMESPACE}" -l app.kubernetes.io/name=tackle-ui -o name) | ||
|
|
||
| # Check if the pod has changed | ||
| if [[ "$PREUPGRADE_UI_POD" != "$UI_POD_AFTER" ]]; then | ||
| echo "UI pod has changed! New pod: $UI_POD_AFTER" | ||
| break | ||
| fi | ||
|
|
||
| # Check if timeout is reached | ||
| if [[ "$ELAPSED" -ge "$TIMEOUT" ]]; then | ||
| echo "Timeout reached! Pod did not change within $TIMEOUT seconds." | ||
| exit 1 # Fail the script if pod did not bounce | ||
| fi | ||
|
|
||
| echo "Pod has not changed yet. Retrying in $INTERVAL seconds..." | ||
| sleep $INTERVAL | ||
| ((ELAPSED+=INTERVAL)) | ||
| done | ||
|
||
| sleep 200s | ||
|
|
||
| kubectl get po -n "${NAMESPACE}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| NAMESPACE="${NAMESPACE:-konveyor-tackle}" | ||
| TEMPLATE_DIR="${TEMPLATE_DIR:-hack/templates}" | ||
| KONVEYOR_UPGRADE_INDEX="${KONVEYOR_UPGRADE_INDEX:-quay.io/migqe/tackle2-operator-upgrade-index:latest}" | ||
|
||
| SUBSCRIPTION_CHANNEL="${SUBSCRIPTION_CHANNEL:-konveyor-0.6}" | ||
| PREUPGRADE_VERSION="${PREUPGRADE_VERSION:-0.6.0}" | ||
| POSTUPGRADE_VERSION="${POSTUPGRADE_VERSION:-99.0.0}" #Always the latest from main. | ||
| echo "Creating namespace" | ||
| echo "${SUBSCRIPTION_CHANNEL}" | ||
| source "${TEMPLATE_DIR}/01_namespace.sh" | ||
|
|
||
| source "${TEMPLATE_DIR}/02_catsrc.sh" | ||
|
|
||
| source "${TEMPLATE_DIR}/03_operatorgroup.sh" | ||
|
|
||
| source "${TEMPLATE_DIR}/04_subscription.sh" | ||
|
|
||
| kubectl get sub -n konveyor-tackle -o yaml #Remove later | ||
|
|
||
|
||
| sleep 60s | ||
| echo "Patching installplan for konveyor..." | ||
|
|
||
| kubectl get installplan -n "${NAMESPACE}" | ||
|
|
||
| kubectl patch installplan $(kubectl get installplan -n "${NAMESPACE}" | egrep "$PREUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' | ||
|
|
||
| sleep 20s | ||
|
|
||
| source "${TEMPLATE_DIR}/05_tacklecr.sh" | ||
|
|
||
| kubectl wait --namespace "${NAMESPACE}" --for=condition=Successful --timeout=600s tackles.tackle.konveyor.io/tackle | ||
| kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=tackle-ui -n "${NAMESPACE}" --timeout=300s | ||
| PREUPGRADE_UI_POD=$(kubectl get pod -l app.kubernetes.io/name=tackle-ui -n "${NAMESPACE}" -o name) | ||
| echo "PREUPGRADE_UI_POD=$PREUPGRADE_UI_POD" >> $GITHUB_ENV | ||
| sleep 120s | ||
|
|
||
| kubectl get po -n "${NAMESPACE}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| cat <<EOF | kubectl apply -f - | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: "${NAMESPACE}" | ||
| EOF | ||
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat << EOF | kubectl create -f - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiVersion: operators.coreos.com/v1alpha1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kind: CatalogSource | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: konveyor-tackle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace: "${NAMESPACE}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spec: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| displayName: Konveyor Operator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| publisher: Konveyor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sourceType: grpc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: "${KONVEYOR_UPGRADE_INDEX}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updateStrategy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| registryPoll: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interval: 10m | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat << EOF | kubectl create -f - | |
| apiVersion: operators.coreos.com/v1alpha1 | |
| kind: CatalogSource | |
| metadata: | |
| name: konveyor-tackle | |
| namespace: "${NAMESPACE}" | |
| spec: | |
| displayName: Konveyor Operator | |
| publisher: Konveyor | |
| sourceType: grpc | |
| image: "${KONVEYOR_UPGRADE_INDEX}" | |
| updateStrategy: | |
| registryPoll: | |
| interval: 10m | |
| EOF | |
| cat << EOF | kubectl apply -f - | |
| apiVersion: operators.coreos.com/v1alpha1 | |
| kind: CatalogSource | |
| metadata: | |
| name: konveyor-tackle | |
| namespace: "${NAMESPACE}" | |
| spec: | |
| displayName: Konveyor Operator | |
| publisher: Konveyor | |
| sourceType: grpc | |
| image: "${KONVEYOR_UPGRADE_INDEX}" | |
| updateStrategy: | |
| registryPoll: | |
| interval: 10m | |
| EOF |
🧰 Tools
🪛 Shellcheck (0.10.0)
[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
(SC2148)
🤖 Prompt for AI Agents
In hack/templates/02_catsrc.sh lines 1 to 15, replace the use of 'kubectl
create' with 'kubectl apply' to make the script idempotent. This change ensures
that rerunning the script does not fail if the CatalogSource resource already
exists, allowing repeated executions without errors.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| cat << EOF | kubectl create -f - | ||
|
||
| apiVersion: operators.coreos.com/v1 | ||
| kind: OperatorGroup | ||
| metadata: | ||
| name: konveyor-tackle | ||
| namespace: "${NAMESPACE}" | ||
| spec: | ||
| targetNamespaces: | ||
| - konveyor-tackle | ||
|
||
| EOF | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| cat <<EOF | kubectl apply -f - | ||
| apiVersion: operators.coreos.com/v1alpha1 | ||
| kind: Subscription | ||
| metadata: | ||
| name: konveyor-operator | ||
| namespace: "${NAMESPACE}" | ||
| spec: | ||
| channel: "${SUBSCRIPTION_CHANNEL}" | ||
| installPlanApproval: "Manual" | ||
|
||
| name: konveyor-operator | ||
| source: konveyor-tackle | ||
| sourceNamespace: konveyor-tackle | ||
| EOF | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| cat <<EOF | kubectl apply -f - | ||
| kind: Tackle | ||
| apiVersion: tackle.konveyor.io/v1alpha1 | ||
| metadata: | ||
| name: tackle | ||
| namespace: "${NAMESPACE}" | ||
| spec: | ||
| feature_auth_required: "true" | ||
| EOF |
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.
🛠️ Refactor suggestion
Checkout v2 is deprecated
Use
actions/checkout@v4everywhere to avoid the “runner too old” warning.📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.7)
15-15: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents