Skip to content

Commit bda7e92

Browse files
committed
removed ununsed comments
1 parent 48e0828 commit bda7e92

File tree

4 files changed

+12
-36
lines changed

4 files changed

+12
-36
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ jobs:
3535
run: make test
3636
- name: Validate
3737
run: make validate
38+

.github/workflows/test-rancher.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
name: Test Rancher Integration
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
rancher_image:
7-
description: 'Rancher server image (leave empty to auto-detect)'
8-
required: false
9-
type: string
10-
agent_image:
11-
description: 'Rancher agent image (leave empty to auto-detect)'
12-
required: false
13-
type: string
14-
skip_setup:
15-
description: 'Skip running the setup program'
16-
required: false
17-
type: boolean
18-
default: false
4+
pull_request: {}
5+
push:
6+
branches:
7+
- master
8+
- release/*
199

2010
jobs:
2111
test-rancher:
22-
runs-on: ubuntu-latest
12+
runs-on:
13+
- runs-on
14+
- spot=true
15+
- runner=8cpu-linux-amd64
16+
- run-id=${{ github.run_id }}
2317
steps:
2418
- name: Checkout repository
2519
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
@@ -51,8 +45,6 @@ jobs:
5145
run: |
5246
bash scripts/test-rancher.sh
5347
env:
54-
RANCHER_IMAGE: ${{ inputs.rancher_image }}
55-
RANCHER_AGENT_IMAGE: ${{ inputs.agent_image }}
5648
CATTLE_BOOTSTRAP_PASSWORD: admin
5749
continue-on-error: false
5850

scripts/build-rancher.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RANCHER_DIR="/tmp/rancher-build/rancher"
88

99
if [ -d "$RANCHER_DIR" ]; then
1010
echo "Rancher repository already exists at $RANCHER_DIR"
11-
echo "Skipping clone. To force a fresh clone, remove the directory first: rm -rf $RANCHER_DIR"
11+
echo "Skipping clone"
1212
else
1313
echo "Cloning rancher repository to $RANCHER_DIR..."
1414
mkdir -p "$(dirname "$RANCHER_DIR")"

scripts/test-rancher.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22

33
set -e
44

5-
# Get the absolute path of the steve directory (this repo)
65
STEVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
76

8-
# Initialize variables from environment or defaults
97
RANCHER_IMAGE="${RANCHER_IMAGE:-}"
108
RANCHER_AGENT_IMAGE="${RANCHER_AGENT_IMAGE:-}"
119
CONTAINER_NAME="rancher-server-test"
1210
BOOTSTRAP_PASSWORD="${CATTLE_BOOTSTRAP_PASSWORD:-admin}"
1311
SKIP_SETUP=false
1412

15-
# Function to detect Rancher images if not provided
1613
detect_rancher_images() {
1714
local rancher_image=$1
1815
local agent_image=$2
@@ -37,12 +34,10 @@ detect_rancher_images() {
3734
fi
3835
fi
3936

40-
# Return values via global variables (bash limitation)
4137
RANCHER_IMAGE="${rancher_image}"
4238
RANCHER_AGENT_IMAGE="${agent_image}"
4339
}
4440

45-
# Function to cleanup on exit
4641
cleanup() {
4742
echo ""
4843
echo "Cleaning up..."
@@ -55,19 +50,16 @@ cleanup() {
5550

5651
trap cleanup EXIT
5752

58-
# Function to detect the machine's primary IP address
5953
detect_rancher_ip() {
6054
local ip=$(hostname -I | awk '{print $1}')
6155
if [ -z "$ip" ]; then
6256
echo "Error: Could not determine IP address" >&2
6357
return 1
6458
fi
65-
# Set global variable
6659
RANCHER_IP="$ip"
6760
echo "Using IP address: $RANCHER_IP"
6861
}
6962

70-
# Function to remove existing container if it exists
7163
remove_existing_container() {
7264
local container_name=$1
7365
if docker ps -a --format '{{.Names}}' | grep -q "^${container_name}$"; then
@@ -77,7 +69,6 @@ remove_existing_container() {
7769
fi
7870
}
7971

80-
# Function to start Rancher server container
8172
start_rancher_server() {
8273
local container_name=$1
8374
local rancher_image=$2
@@ -111,7 +102,6 @@ start_rancher_server() {
111102
trap cleanup_logs EXIT
112103
}
113104

114-
# Function to wait for Rancher to be ready
115105
wait_for_rancher() {
116106
local rancher_ip=$1
117107
local max_wait=${2:-300} # Default 5 minutes
@@ -157,7 +147,6 @@ wait_for_rancher() {
157147
return 1
158148
}
159149

160-
# Function to run the integration test setup
161150
run_setup() {
162151
local steve_dir=$1
163152
local bootstrap_password=$2
@@ -173,20 +162,17 @@ run_setup() {
173162
echo "Running integration test setup..."
174163
cd "${steve_dir}/tests/integration/setup"
175164

176-
# Build setup binary if it doesn't exist
177165
if [ ! -f "./setup" ] || [ "./setup" -ot "./main.go" ]; then
178166
echo "Building setup binary..."
179167
go build -o setup .
180168
fi
181169

182-
# Run setup with required environment variables
183170
export CATTLE_BOOTSTRAP_PASSWORD="${bootstrap_password}"
184171
export CATTLE_AGENT_IMAGE="${agent_image}"
185172
export CATTLE_TEST_CONFIG="${steve_dir}/tests/integration/steveapi/steveapi.yaml"
186173
./setup
187174
}
188175

189-
# Function to run integration tests
190176
run_integration_tests() {
191177
local steve_dir=$1
192178
local bootstrap_password=$2
@@ -208,9 +194,7 @@ run_integration_tests() {
208194
echo "Integration tests completed!"
209195
}
210196

211-
# Main function
212197
main() {
213-
# Parse command line arguments
214198
while [[ $# -gt 0 ]]; do
215199
case $1 in
216200
--rancher-image)
@@ -268,5 +252,4 @@ main() {
268252
run_integration_tests "${STEVE_DIR}" "${BOOTSTRAP_PASSWORD}" "${RANCHER_AGENT_IMAGE}"
269253
}
270254

271-
# Call main function with all arguments
272255
main "$@"

0 commit comments

Comments
 (0)