|
| 1 | +# SPDX-FileCopyrightText: (C) 2026 Intel Corporation |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: "Deploy On-Prem Orchestrator (Helmfile)" |
| 5 | +description: "Deploys the on-prem orchestrator using helmfile — runs pre-orch and post-orch deploy steps" |
| 6 | +inputs: |
| 7 | + orch_version: |
| 8 | + required: false |
| 9 | + description: "Orchestrator version (git ref) to deploy" |
| 10 | + default: '${{ github.sha }}' |
| 11 | + orch_profile: |
| 12 | + required: false |
| 13 | + description: "Orchestrator profile to deploy" |
| 14 | + default: "onprem-eim" |
| 15 | + docker_username: |
| 16 | + required: true |
| 17 | + description: "Docker Hub username for pulling images" |
| 18 | + docker_password: |
| 19 | + required: true |
| 20 | + description: "Docker Hub password for pulling images" |
| 21 | + |
| 22 | +runs: |
| 23 | + using: "composite" |
| 24 | + steps: |
| 25 | + - name: Checkout Orchestrator repo |
| 26 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 27 | + with: |
| 28 | + repository: open-edge-platform/edge-manageability-framework |
| 29 | + ref: ${{ inputs.orch_version }} |
| 30 | + persist-credentials: false |
| 31 | + |
| 32 | + # ── Detect Host IP ──────────────────────────────────────────────────────── |
| 33 | + |
| 34 | + - name: Detect host IP |
| 35 | + id: host-ip |
| 36 | + shell: bash |
| 37 | + run: | |
| 38 | + # Get interface with 10.x.x.x IP (same approach as ci/ven/dnsmasq-setup.sh) |
| 39 | + interface_name=$(ip -o -4 addr show | awk '$4 ~ /^10\./ {print $2}') |
| 40 | + if [ -z "$interface_name" ]; then |
| 41 | + echo "No interface found with 10.x IP, falling back to default route interface" |
| 42 | + interface_name=$(ip route show default | awk '{print $5; exit}') |
| 43 | + fi |
| 44 | + ip_address=$(ip -4 addr show "$interface_name" | grep -oP '(?<=inet\s)\d+(\.\d+){3}') |
| 45 | + if [ -z "$ip_address" ]; then |
| 46 | + echo "❌ Could not detect host IP address" |
| 47 | + exit 1 |
| 48 | + fi |
| 49 | + echo "Detected host IP: $ip_address (interface: $interface_name)" |
| 50 | + echo "host_ip=$ip_address" >> "$GITHUB_OUTPUT" |
| 51 | +
|
| 52 | + - name: Update env files with detected host IP |
| 53 | + shell: bash |
| 54 | + env: |
| 55 | + HOST_IP: ${{ steps.host-ip.outputs.host_ip }} |
| 56 | + ORCH_PROFILE: ${{ inputs.orch_profile }} |
| 57 | + run: | |
| 58 | + echo "Updating pre-orch.env and post-orch.env with EMF_ORCH_IP=$HOST_IP, EMF_HELMFILE_ENV=$ORCH_PROFILE" |
| 59 | +
|
| 60 | + # pre-orch.env: uncomment and set EMF_ORCH_IP, comment out individual IPs |
| 61 | + sed -i "s|^#EMF_ORCH_IP=.*|EMF_ORCH_IP=$HOST_IP|" helmfile-deploy/pre-orch/pre-orch.env |
| 62 | + sed -i "s|^EMF_TRAEFIK_IP=|#EMF_TRAEFIK_IP=|" helmfile-deploy/pre-orch/pre-orch.env |
| 63 | + sed -i "s|^EMF_HAPROXY_IP=|#EMF_HAPROXY_IP=|" helmfile-deploy/pre-orch/pre-orch.env |
| 64 | +
|
| 65 | + # post-orch.env: uncomment and set EMF_ORCH_IP, comment out individual IPs, set profile |
| 66 | + sed -i "s|^#EMF_ORCH_IP=.*|EMF_ORCH_IP=$HOST_IP|" helmfile-deploy/post-orch/post-orch.env |
| 67 | + sed -i "s|^EMF_TRAEFIK_IP=|#EMF_TRAEFIK_IP=|" helmfile-deploy/post-orch/post-orch.env |
| 68 | + sed -i "s|^EMF_HAPROXY_IP=|#EMF_HAPROXY_IP=|" helmfile-deploy/post-orch/post-orch.env |
| 69 | + sed -i "s|^EMF_HELMFILE_ENV=.*|EMF_HELMFILE_ENV=$ORCH_PROFILE|" helmfile-deploy/post-orch/post-orch.env |
| 70 | +
|
| 71 | + echo "✅ Both env files updated" |
| 72 | +
|
| 73 | + # ── Pre-Orch Deploy ────────────────────────────────────────────────────── |
| 74 | + |
| 75 | + - name: Run pre-orch deploy |
| 76 | + shell: bash |
| 77 | + working-directory: helmfile-deploy/pre-orch |
| 78 | + env: |
| 79 | + DOCKER_USERNAME: ${{ inputs.docker_username }} |
| 80 | + DOCKER_PASSWORD: ${{ inputs.docker_password }} |
| 81 | + run: | |
| 82 | + echo "▶ Starting pre-orch deploy (provider: k3s) [timeout: 5m]" |
| 83 | + chmod +x pre-orch.sh |
| 84 | + timeout 300 ./pre-orch.sh k3s install \ |
| 85 | + --docker-username "$DOCKER_USERNAME" \ |
| 86 | + --docker-password "$DOCKER_PASSWORD" |
| 87 | +
|
| 88 | + - name: Verify pre-orch deployment |
| 89 | + shell: bash |
| 90 | + run: | |
| 91 | + echo "Verifying pre-orch components are ready..." |
| 92 | + kubectl get nodes -o wide |
| 93 | + echo "Waiting for all pods to be ready..." |
| 94 | + kubectl wait --for=condition=Ready pods --all -A --timeout=120s || true |
| 95 | + kubectl get pods -A |
| 96 | +
|
| 97 | + # ── Post-Orch Deploy ───────────────────────────────────────────────────── |
| 98 | + |
| 99 | + - name: Run post-orch deploy |
| 100 | + shell: bash |
| 101 | + working-directory: helmfile-deploy/post-orch |
| 102 | + env: |
| 103 | + EMF_HELMFILE_ENV: ${{ inputs.orch_profile }} |
| 104 | + run: | |
| 105 | + echo "▶ Starting post-orch deploy (profile: $EMF_HELMFILE_ENV) [timeout: 20m]" |
| 106 | + chmod +x post-orch-deploy.sh |
| 107 | + timeout 1200 ./post-orch-deploy.sh install |
| 108 | +
|
| 109 | + - name: Verify post-orch deployment |
| 110 | + shell: bash |
| 111 | + working-directory: helmfile-deploy/post-orch |
| 112 | + run: | |
| 113 | + echo "Verifying post-orch deployment..." |
| 114 | + chmod +x watch-deploy.sh |
| 115 | + ./watch-deploy.sh |
| 116 | +
|
| 117 | + # ── Install Orch CA Certificate ────────────────────────────────────────── |
| 118 | + |
| 119 | + - name: Install orchestrator CA certificate |
| 120 | + shell: bash |
| 121 | + run: | |
| 122 | + kubectl get secret -n orch-gateway tls-orch -o jsonpath="{.data.tls\.crt}" | base64 -d > orch-ca.crt |
| 123 | + sudo cp -rf orch-ca.crt /usr/local/share/ca-certificates/ |
| 124 | + sudo update-ca-certificates -f |
| 125 | +
|
| 126 | + # ── Diagnostics ────────────────────────────────────────────────────────── |
| 127 | + |
| 128 | + - name: Get diagnostic information |
| 129 | + id: get-diagnostic-info |
| 130 | + if: always() |
| 131 | + shell: bash |
| 132 | + env: |
| 133 | + ORCH_PROFILE: ${{ inputs.orch_profile }} |
| 134 | + run: | |
| 135 | + mkdir -p "$ORCH_PROFILE-diagnostics" |
| 136 | + kubectl get pods -o wide -A > "$ORCH_PROFILE-diagnostics/pods-list.txt" |
| 137 | + kubectl describe pods -A > "$ORCH_PROFILE-diagnostics/pods-describe.txt" |
| 138 | + kubectl get events -o yaml -A > "$ORCH_PROFILE-diagnostics/events.yaml" |
| 139 | + helm list -A > "$ORCH_PROFILE-diagnostics/helm-releases.txt" |
| 140 | +
|
| 141 | + - name: Upload diagnostic information to CI artifact store |
| 142 | + if: always() && steps.get-diagnostic-info.conclusion == 'success' |
| 143 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 144 | + with: |
| 145 | + name: ${{ inputs.orch_profile }}-helmfile-diagnostics |
| 146 | + path: | |
| 147 | + ${{ inputs.orch_profile }}-diagnostics/pods-list.txt |
| 148 | + ${{ inputs.orch_profile }}-diagnostics/pods-describe.txt |
| 149 | + ${{ inputs.orch_profile }}-diagnostics/events.yaml |
| 150 | + ${{ inputs.orch_profile }}-diagnostics/helm-releases.txt |
0 commit comments