constellation/.github/docs
Fabian Kammel 6564fcbf6c
E2E Test Mini Constellation (#796)
* fix: typo to build amd64 for macos
* Implement E2E test for mini constellation
Signed-off-by: Fabian Kammel <fk@edgeless.systems>
2022-12-14 16:51:42 +01:00
..
conventions.md devdoc: update dev conventions 2022-11-11 13:40:13 +01:00
development.md Upgrade Go version to 1.19 2022-10-28 16:06:53 +02:00
layout.md Remove access manager (#470) 2022-11-11 08:44:36 +01:00
longhorn.md Docs: image changes for Longhorn support 2022-10-28 12:11:43 +02:00
nfs.md docs: verify Ceph encryption 2022-11-09 16:48:11 +01:00
qemu.md AB#2439 Containerized libvirt (#191) 2022-10-05 09:11:30 +02:00
README.md OS images: use "ref", "stream" and "version" 2022-12-09 13:37:43 +01:00
release.md E2E Test Mini Constellation (#796) 2022-12-14 16:51:42 +01:00
upgrade-kubernetes.md kubernetes: use new registry 2022-12-13 16:08:19 +01:00

Actions & Workflows

Manual Trigger (workflow_dispatch)

It is currently not possible to run a workflow_dispatch based workflow on a specific branch, while it is not yet available in main branch, from the WebUI. If you would like to test your pipeline changes on a branch, use the GitHub CLI:

gh workflow run e2e-test-manual.yml \
    --ref feat/e2e_pipeline \                       # On your specific branch!
    -F cloudProvider=gcp \       # With your ...
    -F controlNodesCount=1 -F workerNodesCount=2 \  # ... settings
    -F machineType=n2d-standard-4

E2E Test Suites

Here are some examples for test suits you might want to run. Values for sonobuoyTestSuiteCmd:

  • --mode quick
    • Runs a set of tests that are known to be quick to execute! (<1 min)
  • --e2e-focus "Services should be able to create a functioning NodePort service"
    • Runs a specific test
  • --mode certified-conformance
    • For K8s conformance certification test suite

Check Sonobuoy docs for more examples.

When using --mode be aware that --e2e-focus and e2e-skip will be overwritten. Check in the source code what the different modes do.

Local Development

Using act you can run GitHub actions locally.

These instructions are for internal use. In case you want to use the E2E actions externally, you need to adjust other configuration parameters. Check the assignments made in the [/.github/actions/e2e_test/action.yml](E2E action) and adjust any hard-coded values.

Specific Jobs

act -j e2e-test-gcp

Simulate a workflow_dispatch event

Create a new JSON file to describe the event (relevant issue, there are no further information about structure of this file):

{
  "action": "workflow_dispatch",
  "inputs": {
      "workerNodesCount": "2",
      "controlNodesCount": "1",
      "cloudProvider": "gcp",
      "machineType": "n2d-standard-4",
      "sonobuoyTestSuiteCmd": "--mode quick"
  }
}

Then run act with the event as input:

act -j e2e-test-manual --eventpath event.json

Authorizing GCP

For creating Kubernetes clusters in GCP a local copy of the service account secret is required.

  1. Create a new service account key
  2. Create a compact (one line) JSON representation of the file jq -c
  3. Store in a GitHub Action Secret called GCP_SERVICE_ACCOUNT or create a local secret file for act to consume:
$ cat secrets.env
GCP_SERVICE_ACCOUNT={"type":"service_account", ... }

$ act --secret-file secrets.env

In addition, you need to create a Service Account which Constellation itself is supposed to use. Refer to First steps in the documentation on how to create it. What you need here specifically is the gcpServiceAccountKey, which needs to be stored in a secret called GCP_CLUSTER_SERVICE_ACCOUNT.

Authorizing Azure

Create a new service principal:

az ad sp create-for-rbac --name "github-actions-e2e-tests" --role contributor --scopes /subscriptions/0d202bbb-4fa7-4af8-8125-58c269a05435 --sdk-auth
az role assignment create --role "User Access Administrator" --scope /subscriptions/0d202bbb-4fa7-4af8-8125-58c269a05435 --assignee <SERVICE_PRINCIPAL_CLIENT_ID>

Next, add API permissions to Managed Identity:

Afterward, you need to define a few secrets either as Github Action Secrets or in a secrets file for act as described before.

The following secrets need to be defined:

  • AZURE_E2E_CREDENTIALS: The output of az ad sp ...
  • AZURE_E2E_CLIENT_SECRET: The client secret value for the registered app on Azure (which is defined as appClientID).

For information on how to achieve this, refer to the First steps in the documentation for Constellation.