Skip to content

Commit fd51b04

Browse files
committed
feat(refactor): enhance CI/CD scripts with upgrade testing and cloud provider support
- Introduced a new ShellCheck configuration for improved script linting. - Updated the major chart version from 1.7 to 1.8 across various scripts and configurations. - Added upgrade testing functionality to validate upgrades from previous releases. - Implemented new entry points for auth providers, cleanup, and deployment jobs. - Enhanced documentation to include upgrade flow and cloud provider deployment details. - Refactored Makefile to streamline CI/CD targets and improve usability. This update significantly improves the deployment process and testing capabilities for RHDH.
1 parent 4f54155 commit fd51b04

33 files changed

+1426
-597
lines changed

.ibm/refactored/.shellcheckrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ShellCheck configuration for RHDH CI/CD scripts
2+
3+
# Set shell to bash
4+
shell=bash
5+
6+
# Enable all optional checks
7+
enable=all
8+
9+
# Disable specific checks that are not relevant for our use case
10+
disable=SC2034 # Unused variables (we export many for child scripts)
11+
disable=SC1091 # Not following sourced files (they may not exist at lint time)
12+
13+
# Source path for shellcheck to find files
14+
source-path=SCRIPTDIR
15+
source-path=modules
16+
source-path=jobs
17+
source-path=entrypoints
18+
19+
# External sources that shellcheck should know about
20+
external-sources=true

.ibm/refactored/Makefile

Lines changed: 77 additions & 230 deletions
Large diffs are not rendered by default.

.ibm/refactored/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,92 @@ JOB_NAME=deploy ./openshift-ci-tests.sh
379379

380380
---
381381

382+
## 🔄 Upgrade Flow
383+
384+
### Testing RHDH Upgrades
385+
386+
The upgrade job tests upgrading from a previous release to the current version:
387+
388+
```bash
389+
# Run upgrade test (OpenShift CI)
390+
JOB_NAME=upgrade ./openshift-ci-tests.sh
391+
392+
# Direct execution
393+
./jobs/upgrade.sh
394+
```
395+
396+
#### Upgrade Process:
397+
1. **Install Base Version**: Deploys previous release (e.g., 1.7.x)
398+
2. **Verify Base**: Runs health checks on base deployment
399+
3. **Perform Upgrade**: Uses Helm upgrade to current version (1.8.x)
400+
4. **Validate Upgrade**: Runs comprehensive tests
401+
5. **Rollback on Failure**: Automatic rollback if upgrade fails
402+
403+
#### Configuration:
404+
- Base version auto-detected from `CHART_MAJOR_VERSION`
405+
- Uses diff value files: `value_files/diff-values_showcase_upgrade.yaml`
406+
- Supports orchestrator workflow migration
407+
408+
---
409+
410+
## ☁️ Cloud Provider Deployments
411+
412+
### AWS EKS
413+
```bash
414+
# Helm deployment
415+
JOB_NAME=eks-helm ./openshift-ci-tests.sh
416+
417+
# Operator deployment
418+
JOB_NAME=eks-operator ./openshift-ci-tests.sh
419+
```
420+
421+
### Azure AKS
422+
```bash
423+
# Helm deployment
424+
JOB_NAME=aks-helm ./openshift-ci-tests.sh
425+
426+
# Operator deployment
427+
JOB_NAME=aks-operator ./openshift-ci-tests.sh
428+
429+
# With spot instances
430+
export ENABLE_AKS_SPOT=true
431+
JOB_NAME=aks-helm ./openshift-ci-tests.sh
432+
```
433+
434+
### Google GKE
435+
```bash
436+
# Helm deployment
437+
JOB_NAME=gke-helm ./openshift-ci-tests.sh
438+
439+
# Operator deployment
440+
JOB_NAME=gke-operator ./openshift-ci-tests.sh
441+
442+
# With custom certificate
443+
export GKE_CERT_NAME="my-cert"
444+
JOB_NAME=gke-helm ./openshift-ci-tests.sh
445+
```
446+
447+
### Cloud DNS/Ingress Helpers
448+
449+
New helper functions for cloud providers:
450+
451+
#### EKS
452+
- `cleanup_eks_dns_record` - Removes Route53 DNS records
453+
- `generate_dynamic_domain_name` - Creates unique subdomain
454+
- `get_eks_certificate` - Retrieves ACM certificate ARN
455+
- `cleanup_eks_deployment` - Full namespace cleanup
456+
457+
#### AKS
458+
- `cleanup_aks_deployment` - Removes AKS resources
459+
- `apply_aks_spot_patch` - Applies spot instance tolerations
460+
461+
#### GKE
462+
- `cleanup_gke_dns_record` - Removes Cloud DNS records
463+
- `get_gke_certificate` - Gets SSL certificate name
464+
- `cleanup_gke_deployment` - Full GKE cleanup
465+
466+
---
467+
382468
## 📚 Documentation
383469

384470
> **📖 Full documentation index**: See [docs/README.md](docs/README.md) for complete documentation guide

.ibm/refactored/docs/README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
**Topics:**
4343
- Quick start guide
4444
- Available jobs (deploy, test, cleanup, nightly, etc.)
45+
- Upgrade flow and testing
46+
- Cloud provider deployments (EKS, AKS, GKE)
47+
- Cloud DNS/Ingress helpers
4548
- Makefile commands
4649
- Environment variables
4750
- Local configuration
@@ -149,7 +152,26 @@ Update documentation when:
149152

150153
---
151154

152-
**Last Updated**: 2025-10-09
153-
**Version**: 2.0
155+
## 🆕 New Features (v1.8)
156+
157+
### Upgrade Testing
158+
- **Job**: `upgrade` - Tests upgrading from previous release to current
159+
- **Process**: Install base → Verify → Upgrade → Test → Rollback on failure
160+
- **Files**: `jobs/upgrade.sh`, `value_files/diff-values_showcase_upgrade.yaml`
161+
162+
### Cloud Provider Support
163+
- **AWS EKS**: DNS management via Route53, ACM certificates
164+
- **Azure AKS**: Spot instance support, managed ingress
165+
- **Google GKE**: Cloud DNS integration, SSL certificates
166+
167+
### New Helper Functions
168+
- **DNS Management**: `cleanup_*_dns_record` functions for each cloud
169+
- **Certificate Management**: `get_*_certificate` functions
170+
- **Deployment Cleanup**: `cleanup_*_deployment` for full cleanup
171+
172+
---
173+
174+
**Last Updated**: 2025-10-10
175+
**Version**: 2.1
154176
**Maintainers**: RHDH CI/CD Team
155177

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Direct entry point for auth providers testing
4+
#
5+
set -euo pipefail
6+
7+
# Get script directory
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
export DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
10+
11+
# Source environment
12+
if [[ -f "${DIR}/env_variables.sh" ]]; then
13+
# shellcheck source=../env_variables.sh
14+
source "${DIR}/env_variables.sh"
15+
fi
16+
17+
# Source local overrides if present
18+
if [[ -f "${DIR}/env_override.local.sh" ]]; then
19+
# shellcheck source=/dev/null
20+
source "${DIR}/env_override.local.sh"
21+
fi
22+
23+
# Import the actual job
24+
# shellcheck source=../jobs/auth-providers.sh
25+
source "${DIR}/jobs/auth-providers.sh"
26+
27+
# Execute with all arguments passed through
28+
main "$@"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Direct entry point for cleanup
4+
#
5+
set -euo pipefail
6+
7+
# Get script directory
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
export DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
10+
11+
# Source environment
12+
if [[ -f "${DIR}/env_variables.sh" ]]; then
13+
# shellcheck source=../env_variables.sh
14+
source "${DIR}/env_variables.sh"
15+
fi
16+
17+
# Source local overrides if present
18+
if [[ -f "${DIR}/env_override.local.sh" ]]; then
19+
# shellcheck source=/dev/null
20+
source "${DIR}/env_override.local.sh"
21+
fi
22+
23+
# Source modules needed for cleanup
24+
# shellcheck source=../modules/logging.sh
25+
source "${DIR}/modules/logging.sh"
26+
# shellcheck source=../modules/k8s-operations.sh
27+
source "${DIR}/modules/k8s-operations.sh"
28+
29+
# Main cleanup logic
30+
main() {
31+
log_header "RHDH Cleanup"
32+
33+
local namespaces=(
34+
"${NAME_SPACE:-showcase}"
35+
"${NAME_SPACE_RBAC:-showcase-rbac}"
36+
"${NAME_SPACE_K8S:-showcase-k8s-ci-nightly}"
37+
"${NAME_SPACE_K8S_RBAC:-showcase-rbac-k8s-ci-nightly}"
38+
)
39+
40+
for ns in "${namespaces[@]}"; do
41+
if kubectl get namespace "$ns" &>/dev/null; then
42+
log_info "Cleaning up namespace: $ns"
43+
delete_namespace "$ns"
44+
fi
45+
done
46+
47+
log_success "Cleanup completed"
48+
}
49+
50+
# Execute
51+
main "$@"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Direct entry point for deploy-rbac job
4+
#
5+
set -euo pipefail
6+
7+
# Get script directory
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
export DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
10+
11+
# Source environment
12+
if [[ -f "${DIR}/env_variables.sh" ]]; then
13+
# shellcheck source=../env_variables.sh
14+
source "${DIR}/env_variables.sh"
15+
fi
16+
17+
# Source local overrides if present
18+
if [[ -f "${DIR}/env_override.local.sh" ]]; then
19+
# shellcheck source=/dev/null
20+
source "${DIR}/env_override.local.sh"
21+
fi
22+
23+
# Import the actual job
24+
# shellcheck source=../jobs/deploy-rbac.sh
25+
source "${DIR}/jobs/deploy-rbac.sh"
26+
27+
# Execute with all arguments passed through
28+
main "$@"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Direct entry point for deploy job
4+
# No JOB_NAME dependency - this IS the deploy job
5+
#
6+
set -euo pipefail
7+
8+
# Get script directory
9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
export DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
11+
12+
# Source environment
13+
if [[ -f "${DIR}/env_variables.sh" ]]; then
14+
# shellcheck source=../env_variables.sh
15+
source "${DIR}/env_variables.sh"
16+
fi
17+
18+
# Source local overrides if present
19+
if [[ -f "${DIR}/env_override.local.sh" ]]; then
20+
# shellcheck source=/dev/null
21+
source "${DIR}/env_override.local.sh"
22+
fi
23+
24+
# Import the actual job
25+
# shellcheck source=../jobs/deploy-base.sh
26+
source "${DIR}/jobs/deploy-base.sh"
27+
28+
# Execute with all arguments passed through
29+
main "$@"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Direct entry point for nightly tests
4+
#
5+
set -euo pipefail
6+
7+
# Get script directory
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
export DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
10+
11+
# Source environment
12+
if [[ -f "${DIR}/env_variables.sh" ]]; then
13+
# shellcheck source=../env_variables.sh
14+
source "${DIR}/env_variables.sh"
15+
fi
16+
17+
# Source local overrides if present
18+
if [[ -f "${DIR}/env_override.local.sh" ]]; then
19+
# shellcheck source=/dev/null
20+
source "${DIR}/env_override.local.sh"
21+
fi
22+
23+
# Nightly always uses orchestrator
24+
export DEPLOY_ORCHESTRATOR=true
25+
26+
# Import the actual job
27+
# shellcheck source=../jobs/ocp-nightly.sh
28+
source "${DIR}/jobs/ocp-nightly.sh"
29+
30+
# Execute with all arguments passed through
31+
main "$@"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Direct entry point for operator deployment
4+
#
5+
set -euo pipefail
6+
7+
# Get script directory
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
export DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
10+
11+
# Source environment
12+
if [[ -f "${DIR}/env_variables.sh" ]]; then
13+
# shellcheck source=../env_variables.sh
14+
source "${DIR}/env_variables.sh"
15+
fi
16+
17+
# Source local overrides if present
18+
if [[ -f "${DIR}/env_override.local.sh" ]]; then
19+
# shellcheck source=/dev/null
20+
source "${DIR}/env_override.local.sh"
21+
fi
22+
23+
# Import the actual job
24+
# shellcheck source=../jobs/ocp-operator.sh
25+
source "${DIR}/jobs/ocp-operator.sh"
26+
27+
# Execute with all arguments passed through
28+
main "$@"

0 commit comments

Comments
 (0)