2023-02-03 05:05:42 -05:00
|
|
|
name: e2e test upgrade
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
cloudProvider:
|
|
|
|
description: "Which cloud provider to use."
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- "gcp"
|
|
|
|
- "azure"
|
|
|
|
default: "azure"
|
|
|
|
workerNodesCount:
|
|
|
|
description: "Number of worker nodes to spawn."
|
|
|
|
default: "2"
|
|
|
|
controlNodesCount:
|
|
|
|
description: "Number of control-plane nodes to spawn."
|
|
|
|
default: "3"
|
|
|
|
fromVersion:
|
|
|
|
description: CLI version to create a new cluster with. This has to be a released version, e.g., 'v2.1.3'.
|
|
|
|
type: string
|
|
|
|
required: true
|
2023-02-13 07:58:34 -05:00
|
|
|
gitRef:
|
|
|
|
description: Ref to build upgrading CLI on, empty for HEAD.
|
2023-02-03 05:05:42 -05:00
|
|
|
type: string
|
2023-02-13 07:58:34 -05:00
|
|
|
default: "head"
|
2023-02-03 05:05:42 -05:00
|
|
|
required: false
|
|
|
|
toImage:
|
|
|
|
description: Image (shortpath) the cluster is upgraded to, or empty for main/nightly.
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
toKubernetes:
|
|
|
|
description: Kubernetes version to target for the upgrade, empty for target's default version.
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
toMicroservices:
|
|
|
|
description: Microservice version to target for the upgrade, empty for target's default version.
|
|
|
|
type: string
|
|
|
|
required: false
|
2023-04-24 07:18:57 -04:00
|
|
|
simulatedTargetVersion:
|
|
|
|
description: Enter a version to build the CLI with. This can be used to simulate a patch-upgrade.
|
|
|
|
type: string
|
|
|
|
required: false
|
2023-04-17 11:30:56 -04:00
|
|
|
scheduled:
|
|
|
|
description: Don't set this when triggering manually.
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
required: false
|
2023-02-03 05:05:42 -05:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
cloudProvider:
|
|
|
|
description: "Which cloud provider to use."
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
workerNodesCount:
|
|
|
|
description: "Number of worker nodes to spawn."
|
|
|
|
type: number
|
|
|
|
required: true
|
|
|
|
controlNodesCount:
|
|
|
|
description: "Number of control-plane nodes to spawn."
|
|
|
|
type: number
|
|
|
|
required: true
|
|
|
|
fromVersion:
|
|
|
|
description: CLI version to create a new cluster with. This has to be a released version, e.g., 'v2.1.3'.
|
|
|
|
type: string
|
|
|
|
required: true
|
2023-02-13 07:58:34 -05:00
|
|
|
gitRef:
|
|
|
|
description: Ref to build upgrading CLI on.
|
2023-02-03 05:05:42 -05:00
|
|
|
type: string
|
2023-02-13 07:58:34 -05:00
|
|
|
default: "head"
|
2023-02-03 05:05:42 -05:00
|
|
|
required: false
|
|
|
|
toImage:
|
|
|
|
description: Image (shortpath) the cluster is upgraded to, or empty for main/nightly.
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
toKubernetes:
|
|
|
|
description: Kubernetes version to target for the upgrade, empty for target's default version.
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
toMicroservices:
|
|
|
|
description: Kubernetes version to target for the upgrade, empty for target's default version.
|
|
|
|
type: string
|
|
|
|
required: false
|
2023-04-24 07:18:57 -04:00
|
|
|
simulatedTargetVersion:
|
|
|
|
description: Enter a version to build the CLI with. This can be used to simulate a patch-upgrade.
|
|
|
|
type: string
|
|
|
|
required: false
|
2023-04-17 11:30:56 -04:00
|
|
|
scheduled:
|
|
|
|
description: Whether this is a scheduled run.
|
|
|
|
type: boolean
|
|
|
|
default: false
|
|
|
|
required: false
|
2023-02-03 05:05:42 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
e2e-upgrade:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
permissions:
|
|
|
|
id-token: write
|
2023-04-24 05:32:22 -04:00
|
|
|
checks: write
|
2023-02-03 05:05:42 -05:00
|
|
|
contents: read
|
2023-04-24 05:32:22 -04:00
|
|
|
packages: write
|
2023-02-03 05:05:42 -05:00
|
|
|
steps:
|
2023-02-13 07:58:34 -05:00
|
|
|
- name: Checkout
|
|
|
|
if: inputs.gitRef == 'head'
|
2023-05-05 08:42:20 -04:00
|
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-02-03 05:05:42 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
|
|
|
|
2023-02-13 07:58:34 -05:00
|
|
|
- name: Checkout ref
|
|
|
|
if: inputs.gitRef != 'head'
|
2023-05-05 08:42:20 -04:00
|
|
|
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2023-02-13 07:58:34 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ inputs.gitRef }}
|
|
|
|
|
2023-02-03 05:05:42 -05:00
|
|
|
- name: Setup Go environment
|
2023-04-04 05:06:30 -04:00
|
|
|
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
|
2023-02-03 05:05:42 -05:00
|
|
|
with:
|
2023-05-11 08:14:15 -04:00
|
|
|
go-version: "1.20.4"
|
2023-02-03 05:05:42 -05:00
|
|
|
|
|
|
|
- name: Login to AWS
|
|
|
|
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
|
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubConstellationVersionsAPIRead
|
|
|
|
aws-region: eu-central-1
|
|
|
|
|
|
|
|
- name: Find latest nightly image
|
|
|
|
id: find-image
|
|
|
|
if: inputs.toImage == ''
|
|
|
|
uses: ./.github/actions/versionsapi
|
|
|
|
with:
|
|
|
|
command: latest
|
|
|
|
ref: main
|
|
|
|
stream: nightly
|
|
|
|
|
2023-04-24 07:18:57 -04:00
|
|
|
- name: Simulate patch upgrade
|
|
|
|
if: inputs.simulatedTargetVersion != ''
|
|
|
|
run: |
|
|
|
|
echo ${{ inputs.simulatedTargetVersion }} > version.txt
|
|
|
|
|
2023-02-03 05:05:42 -05:00
|
|
|
- name: Create cluster with 'fromVersion' CLI.
|
|
|
|
id: e2e_test
|
|
|
|
uses: ./.github/actions/e2e_test
|
|
|
|
with:
|
|
|
|
workerNodesCount: ${{ inputs.workerNodesCount }}
|
|
|
|
controlNodesCount: ${{ inputs.controlNodesCount }}
|
|
|
|
cloudProvider: ${{ inputs.cloudProvider }}
|
|
|
|
osImage: ${{ inputs.fromVersion }}
|
|
|
|
isDebugImage: "false"
|
2023-04-13 04:49:45 -04:00
|
|
|
cliVersion: ${{ inputs.fromVersion }}
|
2023-02-03 05:05:42 -05:00
|
|
|
gcpProject: ${{ secrets.GCP_E2E_PROJECT }}
|
2023-04-12 07:24:13 -04:00
|
|
|
gcpClusterCreateServiceAccount: "constellation-e2e-cluster@constellation-331613.iam.gserviceaccount.com"
|
|
|
|
gcpIAMCreateServiceAccount: "constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com"
|
|
|
|
gcpInClusterServiceAccountKey: ${{ secrets.GCP_CLUSTER_SERVICE_ACCOUNT }}
|
2023-02-03 05:05:42 -05:00
|
|
|
test: "nop"
|
|
|
|
buildBuddyApiKey: ${{ secrets.BUILDBUDDY_ORG_API_KEY }}
|
2023-04-12 07:24:13 -04:00
|
|
|
azureClusterCreateCredentials: ${{ secrets.AZURE_E2E_CLUSTER_CREDENTIALS }}
|
|
|
|
azureIAMCreateCredentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
|
2023-04-04 04:16:04 -04:00
|
|
|
registry: ghcr.io
|
|
|
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
2023-02-03 05:05:42 -05:00
|
|
|
|
|
|
|
- name: Run upgrade test
|
2023-04-13 04:50:51 -04:00
|
|
|
env:
|
|
|
|
KUBECONFIG: ${{ steps.e2e_test.outputs.kubeconfig }}
|
|
|
|
IMAGE: ${{ inputs.toImage && inputs.toImage || steps.find-image.outputs.output }}
|
|
|
|
KUBERNETES: ${{ inputs.toKubernetes }}
|
|
|
|
MICROSERVICES: ${{ inputs.toMicroservices }}
|
|
|
|
WORKERNODES: ${{ inputs.workerNodesCount }}
|
|
|
|
CONTROLNODES: ${{ inputs.controlNodesCount }}
|
2023-02-03 05:05:42 -05:00
|
|
|
run: |
|
|
|
|
echo "Image target: $IMAGE"
|
|
|
|
echo "K8s target: $KUBERNETES"
|
|
|
|
echo "Microservice target: $MICROSERVICES"
|
|
|
|
|
|
|
|
if [[ -n ${MICROSERVICES} ]]; then
|
2023-04-13 09:58:37 -04:00
|
|
|
MICROSERVICES_FLAG="--target-microservices=$MICROSERVICES"
|
2023-02-03 05:05:42 -05:00
|
|
|
fi
|
|
|
|
if [[ -n ${KUBERNETES} ]]; then
|
2023-04-13 09:58:37 -04:00
|
|
|
KUBERNETES_FLAG="--target-kubernetes=$KUBERNETES"
|
2023-02-03 05:05:42 -05:00
|
|
|
fi
|
|
|
|
|
2023-04-28 08:44:01 -04:00
|
|
|
bazelisk run //bazel/release:push
|
2023-02-03 05:05:42 -05:00
|
|
|
bazelisk run //e2e/internal/upgrade:upgrade_test -- --want-worker "$WORKERNODES" --want-control "$CONTROLNODES" --target-image "$IMAGE" "$KUBERNETES_FLAG" "$MICROSERVICES_FLAG"
|
|
|
|
|
|
|
|
- name: Always fetch logs
|
|
|
|
if: always()
|
2023-04-13 04:50:51 -04:00
|
|
|
env:
|
|
|
|
KUBECONFIG: ${{ steps.e2e_test.outputs.kubeconfig }}
|
2023-02-03 05:05:42 -05:00
|
|
|
run: |
|
|
|
|
kubectl logs -n kube-system -l "app.kubernetes.io/name=node-maintenance-operator" --tail=-1 > node-maintenance-operator.logs
|
|
|
|
kubectl get nodeversions.update.edgeless.systems constellation-version -o yaml > constellation-version.yaml
|
|
|
|
|
|
|
|
- name: Always upload logs
|
|
|
|
if: always()
|
2023-04-03 10:36:43 -04:00
|
|
|
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
2023-02-03 05:05:42 -05:00
|
|
|
with:
|
|
|
|
name: upgrade-logs
|
|
|
|
path: |
|
|
|
|
node-maintenance-operator.logs
|
|
|
|
constellation-version.yaml
|
|
|
|
|
|
|
|
- name: Always terminate cluster
|
|
|
|
if: always()
|
|
|
|
uses: ./.github/actions/constellation_destroy
|
|
|
|
with:
|
|
|
|
kubeconfig: ${{ steps.e2e_test.outputs.kubeconfig }}
|
|
|
|
|
2023-04-13 04:49:45 -04:00
|
|
|
- name: Always delete IAM configuration
|
|
|
|
if: always()
|
|
|
|
uses: ./.github/actions/constellation_iam_destroy
|
|
|
|
with:
|
|
|
|
cloudProvider: ${{ inputs.cloudProvider }}
|
|
|
|
azureCredentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }}
|
|
|
|
gcpServiceAccount: "constellation-iam-e2e@constellation-331613.iam.gserviceaccount.com"
|
2023-04-12 10:06:26 -04:00
|
|
|
|
2023-04-27 08:03:49 -04:00
|
|
|
- name: Always upload Terraform logs
|
|
|
|
if: always()
|
|
|
|
uses: ./.github/actions/upload_terraform_logs
|
|
|
|
with:
|
|
|
|
artifactNameSuffix: ${{ steps.e2e_test.outputs.namePrefix }}
|
|
|
|
|
2023-04-12 10:06:26 -04:00
|
|
|
- name: Notify about failure
|
2023-04-17 11:30:56 -04:00
|
|
|
if: |
|
|
|
|
failure() &&
|
|
|
|
github.ref == 'refs/heads/main' &&
|
2023-04-18 08:50:36 -04:00
|
|
|
github.event_name == 'workflow_call' &&
|
2023-04-17 11:30:56 -04:00
|
|
|
inputs.scheduled == 'true'
|
2023-04-12 10:06:26 -04:00
|
|
|
continue-on-error: true
|
|
|
|
uses: ./.github/actions/notify_failure
|
|
|
|
with:
|
|
|
|
projectWriteToken: ${{ secrets.PROJECT_WRITE_TOKEN }}
|
|
|
|
teamsWebhookUri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }}
|
|
|
|
test: "upgrade"
|
|
|
|
provider: ${{ inputs.cloudProvider }}
|