Skip to content

Commit 5776bc6

Browse files
ElderMattElderMatt
and
ElderMatt
authored
feat: removed digitalocean deploy (#1615)
Co-authored-by: ElderMatt <“[email protected]”>
1 parent 43a050e commit 5776bc6

File tree

1 file changed

+1
-162
lines changed

1 file changed

+1
-162
lines changed

.github/workflows/integration.yml

+1-162
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
cloud_provider:
66
description: Provider where Otomi will be installed
77
type: string
8-
default: scaleway
8+
default: linode
99
kubernetes_versions:
1010
description: "Kubernetes versions (JSON formatted list e.g.: ['1.27'])"
1111
type: string
@@ -50,7 +50,6 @@ on:
5050
options:
5151
- scaleway
5252
- linode
53-
- digitalocean
5453
default: 'linode'
5554
kubernetes_versions:
5655
description: 'Kubernetes version'
@@ -129,8 +128,6 @@ env:
129128
SCALEWAY_NODE_TYPE: PRO2-M
130129
SCALEWAY_NODE_POOL_MIN_SIZE: 3
131130
SCALEWAY_VPC_ID: e1019b0c-7c7d-49ef-86e4-b02f55b2e0d3
132-
DIGITALOCEAN_NODE_SIZE: s-8vcpu-16gb
133-
DIGITALOCEAN_NODE_POOL_MIN_SIZE: 3
134131
CHECK_CONTEXT: continuous-integration/integration-test
135132
COMMIT_ID: '${{ github.event.pull_request.head.sha || github.sha }}'
136133
BOT_EMAIL: ${{ vars.BOT_EMAIL }}
@@ -177,30 +174,6 @@ jobs:
177174
echo $versions
178175
echo "versions=$versions" >> $GITHUB_OUTPUT
179176
180-
preprocess-digitalocean-input:
181-
needs: preprocess-input
182-
if: ${{ inputs.cloud_provider == 'digitalocean' }}
183-
name: Preprocess input variables for digital ocean
184-
runs-on: ubuntu-latest
185-
outputs:
186-
kubernetes_versions: ${{ steps.k8s-versions.outputs.versions }}
187-
steps:
188-
- name: Install doctl
189-
uses: digitalocean/action-doctl@v2
190-
with:
191-
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
192-
- id: k8s-versions
193-
name: Process k8s version input
194-
run: |
195-
if [ -z '${{ inputs.kubernetes_versions }}' ]; then
196-
echo "Kubernetes versions not specified, determine DO supported versions"
197-
versions=`doctl kubernetes options versions -o json | jq -ce 'map(.kubernetes_versions)'`
198-
else
199-
versions='${{ inputs.kubernetes_versions }}'
200-
fi
201-
echo $versions
202-
echo "versions=$versions" >> $GITHUB_OUTPUT
203-
204177
preprocess-linode-input:
205178
needs: preprocess-input
206179
if: ${{ inputs.cloud_provider == 'linode' }}
@@ -364,140 +337,6 @@ jobs:
364337
SLACK_TITLE: Scheduled integration tests
365338
SLACK_USERNAME: RedKubesBot
366339

367-
run-integration-test-digitalocean:
368-
if: ${{ inputs.cloud_provider == 'digitalocean' }}
369-
name: Run integration test on digitalocean cluster
370-
needs: preprocess-digitalocean-input
371-
runs-on: ubuntu-latest
372-
strategy:
373-
fail-fast: false
374-
matrix:
375-
kubernetes_versions: ${{ fromJSON(needs.preprocess-digitalocean-input.outputs.kubernetes_versions) }}
376-
max-parallel: 5
377-
steps:
378-
- name: Install doctl
379-
uses: digitalocean/action-doctl@v2
380-
with:
381-
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
382-
- name: Set k8s cluster name
383-
run: |
384-
echo "DIGITALOCEAN_CLUSTER_NAME=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')-$(TZ='GMT-2' date +'%m-%d-%H-%M')" >> $GITHUB_ENV
385-
# Cluster name must be no longer than 63 characters
386-
- name: Determine exact k8s version
387-
run: |
388-
echo "DIGITALOCEAN_K8S_VERSION=$(doctl kubernetes options versions -o json | jq -r '.[] | select(.kubernetes_version | startswith("${{ matrix.kubernetes_versions }}")) | .slug')" >> $GITHUB_ENV
389-
390-
- name: Get default VPC for region
391-
run: |
392-
echo DIGITALOCEAN_VPC_UUID=`doctl vpcs list -o json | jq -re 'map(select((.region == "ams3") and .default)) | .[0] | .id'` >> $GITHUB_ENV
393-
- name: Create k8s cluster for testing
394-
run: |
395-
doctl kubernetes cluster create ${{ env.DIGITALOCEAN_CLUSTER_NAME }} \
396-
--tag source:github \
397-
--ha \
398-
--maintenance-window any=03:00 \
399-
--region ams3 \
400-
--vpc-uuid ${{ env.DIGITALOCEAN_VPC_UUID }} \
401-
--node-pool "name=int-test-${{ strategy.job-index }}-${{ env.COMMIT_ID }};size=${{ env.DIGITALOCEAN_NODE_SIZE }};tag=integration-test;auto-scale=true;min-nodes=${{ env.DIGITALOCEAN_NODE_POOL_MIN_SIZE }};max-nodes=5;count=${{ env.DIGITALOCEAN_NODE_POOL_MIN_SIZE }};" \
402-
--version ${{ env.DIGITALOCEAN_K8S_VERSION }} \
403-
--wait
404-
- name: Retrieve cluster id
405-
run: echo DIGITALOCEAN_CLUSTER_ID=`doctl kubernetes cluster get ${{ env.DIGITALOCEAN_CLUSTER_NAME }} --format ID --no-header` >> $GITHUB_ENV
406-
- name: Assign the cluster to the project
407-
run: doctl projects resources assign ${{ secrets.DIGITALOCEAN_PROJECT }} --resource=do:kubernetes:${{ env.DIGITALOCEAN_CLUSTER_ID }}
408-
- name: Save kubectl config with auth token
409-
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 36000 ${{ env.DIGITALOCEAN_CLUSTER_NAME }}
410-
- name: Get kubectl environment
411-
run: echo DIGITALOCEAN_CLUSTER_CONTEXT=`kubectl config current-context` >> $GITHUB_ENV
412-
- name: Create image pull secret on test cluster
413-
run: |
414-
kubectl create secret docker-registry reg-otomi-github \
415-
--docker-server=${{ env.CACHE_REGISTRY }} \
416-
--docker-username=${{ env.BOT_USERNAME }} \
417-
--docker-password='${{ secrets.BOT_PULL_TOKEN }}'
418-
- name: Checkout
419-
uses: actions/checkout@v4
420-
- name: Prepare Otomi chart
421-
if: ${{ inputs.install_profile != 'no-otomi' }}
422-
run: |
423-
ref=${{ github.event.pull_request.head.ref || github.ref }}
424-
tag=${ref##*/}
425-
sed --in-place "s/APP_VERSION_PLACEHOLDER/$tag/g" chart/apl/Chart.yaml
426-
sed --in-place "s/CONTEXT_PLACEHOLDER/${{ env.DIGITALOCEAN_CLUSTER_CONTEXT }}/g" tests/integration/${{ inputs.install_profile }}.yaml
427-
sed --in-place "s/OTOMI_VERSION_PLACEHOLDER/${GITHUB_REF##*/}/g" tests/integration/${{ inputs.install_profile }}.yaml
428-
touch values-container-registry.yaml
429-
430-
# If a pipeline installs Otomi from the semver tag then pull container image from DockerHub
431-
[[ ${GITHUB_REF##*/} =~ ^v[0-9].+$ ]] && exit 0
432-
433-
# Pull image from cache registry
434-
cat << EOF > values-container-registry.yaml
435-
imageName: "${{ env.CACHE_REGISTRY }}/${{ env.CACHE_REPO }}"
436-
imagePullSecretNames:
437-
- reg-otomi-github
438-
EOF
439-
- name: Otomi install
440-
if: ${{ inputs.install_profile != 'no-otomi' }}
441-
env:
442-
AZ_DNS: ${{ secrets.AZ_DNS }}
443-
AZ_KMS: ${{ secrets.AZ_KMS }}
444-
AZ_OIDC: ${{ secrets.AZ_OIDC }}
445-
LETSENCRYPT_STAGING: ${{ secrets.LETSENCRYPT_STAGING }}
446-
LETSENCRYPT_PRODUCTION: ${{ secrets.LETSENCRYPT_PRODUCTION }}
447-
OTOMI_LICENSE: ${{ secrets.OTOMI_LICENSE }}
448-
run: |
449-
domainSuffix=''
450-
touch values.yaml
451-
[[ '${{ inputs.license }}' == 'yes' ]] && echo "$OTOMI_LICENSE" >> values.yaml
452-
[[ '${{ inputs.dns }}' == 'az_dns' ]] && echo "$AZ_DNS" >> values.yaml && domainSuffix='--set cluster.domainSuffix=tst-${{ github.run_id }}.aks.redkubes.net'
453-
[[ '${{ inputs.kms }}' == 'az_kms' ]] && echo "$AZ_KMS" >> values.yaml
454-
[[ '${{ inputs.oidc }}' == 'az_oidc' ]] && echo "$AZ_OIDC" >> values.yaml
455-
[[ '${{ inputs.certificate }}' == 'letsencrypt_staging' ]] && echo "$LETSENCRYPT_STAGING" >> values.yaml
456-
[[ '${{ inputs.certificate }}' == 'letsencrypt_production' ]] && echo "$LETSENCRYPT_PRODUCTION" >> values.yaml
457-
458-
install_args="--wait --wait-for-jobs --timeout 90m0s otomi chart/apl \
459-
--values tests/integration/${{ inputs.install_profile }}.yaml \
460-
--values values-container-registry.yaml
461-
--values values.yaml \
462-
--set cluster.provider=${{ inputs.cloud_provider }}
463-
$domainSuffix"
464-
465-
[[ '${{ inputs.generate_password }}' == 'no' ]] && install_args="$install_args --set otomi.adminPassword=welcomeotomi"
466-
467-
helm install $install_args
468-
469-
- name: Gather k8s events on failure
470-
if: failure()
471-
run: |
472-
kubectl get events --sort-by='.lastTimestamp' -A
473-
- name: Gather k8s pods on failure
474-
if: failure()
475-
run: |
476-
kubectl get pods -A -o wide
477-
- name: Gather otomi logs on failure
478-
if: failure()
479-
run: |
480-
kubectl logs jobs/otomi --tail 150
481-
- name: Gather otomi-e2e logs on failure
482-
if: failure()
483-
run: |
484-
kubectl logs -n maintenance -l app.kubernetes.io/instance=job-e2e --tail 15000
485-
- name: Remove the test cluster
486-
if: always()
487-
run: |
488-
[[ "${{ inputs.cluster_persistence }}" == "preserve" ]] && echo "The cluster ${{ env.DIGITALOCEAN_CLUSTER_NAME }} will NOT be destroyed!!" && exit 0
489-
doctl kubernetes cluster delete ${{ env.DIGITALOCEAN_CLUSTER_NAME }} -f --dangerous
490-
- name: Slack Notification
491-
if: always()
492-
uses: rtCamp/action-slack-notify@v2
493-
env:
494-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
495-
SLACK_CHANNEL: github-ci
496-
SLACK_COLOR: ${{ job.status }}
497-
SLACK_ICON: https://github.com/redkubes.png?size=48
498-
SLACK_TITLE: Scheduled integration tests
499-
SLACK_USERNAME: RedKubesBot
500-
501340
run-integration-test-linode:
502341
if: ${{ inputs.cloud_provider == 'linode' }}
503342
name: Run integration test on linode cluster

0 commit comments

Comments
 (0)