|
| 1 | +name: New Deploy DEV01 OpenWIFI Cloud SDK |
| 2 | + |
| 3 | +defaults: |
| 4 | + run: |
| 5 | + shell: bash |
| 6 | + |
| 7 | +env: |
| 8 | + AWS_EKS_NAME: tip-openlan-lab |
| 9 | + K8S_VERSION: "1.36.1" |
| 10 | + AWS_DEFAULT_OUTPUT: json |
| 11 | + AWS_DEFAULT_REGION: ap-south-1 |
| 12 | + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} |
| 13 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }} |
| 14 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }} |
| 15 | + |
| 16 | + # Insta certs: |
| 17 | + #WEBSOCKET_CERT: ${{ secrets.INSTA_WEBSOCKET_CERT }} |
| 18 | + #WEBSOCKET_KEY: ${{ secrets.INSTA_WEBSOCKET_KEY }} |
| 19 | + # DigiCert certs: |
| 20 | + WEBSOCKET_CERT: ${{ secrets.DIGICERT_CERT }} |
| 21 | + WEBSOCKET_KEY: ${{ secrets.DIGICERT_KEY }} |
| 22 | + |
| 23 | + # https://stackoverflow.com/questions/59977364/github-actions-how-use-strategy-matrix-with-script |
| 24 | + # Required object fiels per environment: |
| 25 | + # - namespace - namespace suffix that will used added for the Kubernetes environment (i.e. if you pass 'test', kubernetes namespace will be named 'openwifi-test') |
| 26 | + # - deploy_method - deployment method for the chart deployment (supported methods - 'git' (will use helm-git from assembly chart) and 'bundle' (will use chart stored in the Artifactory0 |
| 27 | + # - chart_version - version of chart to be deployed from assembly chart (for 'git' method git ref may be passed, for 'bundle' method version of chart may be passed) |
| 28 | + # - owgw_version - OpenWIFI Gateway version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 29 | + # - owsec_version - OpenWIFI Security version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 30 | + # - owfms_version - OpenWIFI Firmware version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 31 | + # - owprov_version - OpenWIFI Provisioning version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 32 | + # - owanalytics_version - OpenWIFI Analytics version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 33 | + # - owsub_version - OpenWIFI Subscription (Userportal) version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 34 | + # - owrrm_version - OpenWIFI radio resource management service version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 35 | + # - owgwui_version - OpenWIFI Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 36 | + # - owprovui_version - OpenWIFI Provisioning Web UI version to deploy (will be used for Docker image tag and git branch for Helm chart if git deployment is required) |
| 37 | + testbeds: '[ |
| 38 | + { |
| 39 | + "namespace": "dev01", |
| 40 | + "deploy_method": "git", |
| 41 | + "chart_version": "${{ github.event.inputs.chart_version }}", |
| 42 | + "owgw_version": "master", |
| 43 | + "owsec_version": "main", |
| 44 | + "owfms_version": "main", |
| 45 | + "owprov_version": "main", |
| 46 | + "owanalytics_version": "main", |
| 47 | + "owsub_version": "main", |
| 48 | + "owrrm_version": "main", |
| 49 | + "owgwui_version": "main", |
| 50 | + "owprovui_version": "main" |
| 51 | + } |
| 52 | + ]' |
| 53 | + |
| 54 | +on: |
| 55 | + workflow_dispatch: |
| 56 | + inputs: |
| 57 | + chart_version: |
| 58 | + description: 'Chart version to deploy eg: v4.1.0, if force latest not set' |
| 59 | + required: true |
| 60 | + default: 'main' |
| 61 | + force_latest: |
| 62 | + default: 'false' |
| 63 | + description: 'Force deployment of the latest versions of all microservices ignoring matrix versions' |
| 64 | + required: true |
| 65 | + id: |
| 66 | + description: 'run identifier' |
| 67 | + required: false |
| 68 | + |
| 69 | +jobs: |
| 70 | + id: |
| 71 | + name: Workflow ID Provider |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - name: ${{ github.event.inputs.id }} |
| 75 | + run: echo run identifier ${{ inputs.id }} |
| 76 | + |
| 77 | + generate-matrix: |
| 78 | + name: Generate matrix for build |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: |
| 81 | + - id |
| 82 | + outputs: |
| 83 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 84 | + steps: |
| 85 | + - name: generate-matrix |
| 86 | + id: set-matrix |
| 87 | + run: | |
| 88 | + cat >> $GITHUB_OUTPUT << EOF |
| 89 | + matrix={"include":${{ env.testbeds }}} |
| 90 | + EOF |
| 91 | +
|
| 92 | + deploy: |
| 93 | + name: Update OpenWIFI Cloud SDK instances |
| 94 | + runs-on: ubuntu-latest |
| 95 | + needs: |
| 96 | + - id |
| 97 | + - generate-matrix |
| 98 | + strategy: |
| 99 | + matrix: ${{ fromJson( needs.generate-matrix.outputs.matrix ) }} |
| 100 | + fail-fast: false |
| 101 | + steps: |
| 102 | + |
| 103 | + - name: Checkout repo with Helm values |
| 104 | + uses: actions/checkout@v4 |
| 105 | + with: |
| 106 | + repository: Telecominfraproject/wlan-cloud-ucentral-deploy |
| 107 | + path: wlan-cloud-ucentral-deploy |
| 108 | + ref: ${{ matrix.chart_version }} |
| 109 | + |
| 110 | + - name: Prepare certificates from secrets |
| 111 | + working-directory: wlan-cloud-ucentral-deploy/chart/environment-values |
| 112 | + run: | |
| 113 | + echo "${{ env.WEBSOCKET_CERT }}" | base64 -d > cert.pem |
| 114 | + echo "${{ env.WEBSOCKET_KEY }}" | base64 -d > key.pem |
| 115 | +
|
| 116 | + - name: Fetch kubeconfig |
| 117 | + run: | |
| 118 | + aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }} |
| 119 | +
|
| 120 | + - name: Install kubectl |
| 121 | + run: | |
| 122 | + curl -s -LO "https://dl.k8s.io/release/${{ env.K8S_VERSION }}/bin/linux/amd64/kubectl" |
| 123 | + sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl |
| 124 | +
|
| 125 | + - name: Deploy OpenWIFI Cloud SDK |
| 126 | + working-directory: wlan-cloud-ucentral-deploy/chart/environment-values |
| 127 | + run: | |
| 128 | + export NAMESPACE=${{ matrix.namespace }} |
| 129 | + export RTTY_TOKEN=${{ secrets.RTTY_TOKEN }} |
| 130 | + export OWGW_AUTH_USERNAME=${{ secrets.UCENTRALGW_AUTH_USERNAME }} |
| 131 | + export OWGW_AUTH_PASSWORD=${{ secrets.UCENTRALGW_AUTH_PASSWORD }} |
| 132 | + export OWFMS_S3_SECRET=${{ secrets.UCENTRALFMS_S3_SECRET }} |
| 133 | + export OWFMS_S3_KEY=${{ secrets.UCENTRALFMS_S3_KEY }} |
| 134 | + export CERT_LOCATION=cert.pem |
| 135 | + export KEY_LOCATION=key.pem |
| 136 | + export OWSEC_NEW_PASSWORD=${{ secrets.OWSEC_NEW_PASSWORD }} |
| 137 | + export MAILER_USERNAME=${{ secrets.MAILER_USERNAME }} |
| 138 | + export MAILER_PASSWORD=${{ secrets.MAILER_PASSWORD }} |
| 139 | + export IPTOCOUNTRY_IPINFO_TOKEN=${{ secrets.IPTOCOUNTRY_IPINFO_TOKEN }} |
| 140 | + export DOMAIN=lab.open-lan.org |
| 141 | + export CERTIFICATE_ARN=arn:aws:acm:ap-south-1:289708231103:certificate/2da39707-c340-48ec-a819-0014126548af |
| 142 | + # use insta + digicert chaincerts here |
| 143 | + export VALUES_FILE_LOCATION=values.openwifi-qa.yaml,values.openwifi-qa.single-external-db.yaml,values.openwifi-qa.separate-lbs.yaml |
| 144 | + if [[ "${{ github.event.inputs.force_latest }}" == "false" ]]; then |
| 145 | + export DEPLOY_METHOD=${{ matrix.deploy_method }} |
| 146 | + export CHART_VERSION=${{ matrix.chart_version }} |
| 147 | + export OWGW_VERSION=${{ matrix.owgw_version }} |
| 148 | + export OWGWUI_VERSION=${{ matrix.owgwui_version }} |
| 149 | + export OWSEC_VERSION=${{ matrix.owsec_version }} |
| 150 | + export OWFMS_VERSION=${{ matrix.owfms_version }} |
| 151 | + export OWPROV_VERSION=${{ matrix.owprov_version }} |
| 152 | + export OWPROVUI_VERSION=${{ matrix.owprovui_version }} |
| 153 | + export OWANALYTICS_VERSION=${{ matrix.owanalytics_version }} |
| 154 | + export OWSUB_VERSION=${{ matrix.owsub_version }} |
| 155 | + export OWRRM_VERSION=${{ matrix.owrrm_version }} |
| 156 | + else |
| 157 | + export DEPLOY_METHOD=git |
| 158 | + export CHART_VERSION=main |
| 159 | + export OWGW_VERSION=master |
| 160 | + export OWGWUI_VERSION=main |
| 161 | + export OWSEC_VERSION=main |
| 162 | + export OWFMS_VERSION=main |
| 163 | + export OWPROV_VERSION=main |
| 164 | + export OWPROVUI_VERSION=main |
| 165 | + export OWANALYTICS_VERSION=main |
| 166 | + export OWSUB_VERSION=main |
| 167 | + export OWRRM_VERSION=main |
| 168 | + fi |
| 169 | + ./deploy.sh |
| 170 | +
|
| 171 | + - name: Show resource state on deployment failure |
| 172 | + if: failure() |
| 173 | + run: | |
| 174 | + kubectl get pods --namespace openwifi-${{ matrix.namespace }} |
| 175 | + kubectl get services --namespace openwifi-${{ matrix.namespace }} |
| 176 | + kubectl get persistentvolumeclaims --namespace openwifi-${{ matrix.namespace }} |
| 177 | +
|
| 178 | + - name: Describe pods on deployment failure |
| 179 | + if: failure() |
| 180 | + run: | |
| 181 | + kubectl describe pods --namespace openwifi-${{ matrix.namespace }} |
| 182 | +
|
| 183 | + - name: Describe services on deployment failure |
| 184 | + if: failure() |
| 185 | + run: | |
| 186 | + kubectl describe services --namespace openwifi-${{ matrix.namespace }} |
| 187 | +
|
| 188 | + - name: Describe persistentvolumeclaims on deployment failure |
| 189 | + if: failure() |
| 190 | + run: | |
| 191 | + kubectl describe persistentvolumeclaims --namespace openwifi-${{ matrix.namespace }} |
| 192 | +
|
| 193 | + - name: Rollback Cloud SDK |
| 194 | + #if: failure() |
| 195 | + # don't roll back so easier to diagnose issues |
| 196 | + if: false |
| 197 | + run: | |
| 198 | + helm rollback tip-openwifi --namespace openwifi-${{ matrix.namespace }} --wait --timeout 20m |
0 commit comments