constellation/.github/docs/README.md
Daniel Weiße 5da92d9d8b AB#2249 Rework image build pipeline (#326)
* Rework image build pipeline

* Dont cancel workflow runs on main

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
2022-08-03 16:01:36 +02:00

5.3 KiB

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 autoscale=false -F cloudProvider=gcp \       # With your ...
    -F controlNodesCount=1 -F workerNodesCount=2 \  # ... settings
    -F machineType=n2d-standard-2

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 nektos/act you can run GitHub actions locally.

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",
      "autoscale": false,
      "cloudProvider": "gcp",
      "machineType": "n2d-standard-2",
      "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 GitHub Action Secret or create a local secret file for act to consume:
$ cat secrets.env
GCP_SERVICE_ACCOUNT={"type":"service_account", ... }

$ act --secret-file secrets.env

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

Store output of az ad sp ... in GitHub Action Secret or create a local secret file for act to consume.

Image versions

The build-coreos workflow can be used to trigger an image build.

The workflow can be used to build debug or release images. A debug image uses debugd as its bootstrapper binary, while release images use the actual bootstrapper Workflows for the main branch will always build debug images.

The image will be named and categorized depending on the branch the build is triggered from. In the following, Release refers to non debug images build from a release branch, e.g. release/v1.4.0, Debug refers to debug images build from either main or a release branch, and Branch refers to any image build from a branch that is not main or a release branch. Non debug images built from main follow the Branch image naming scheme.

GCP

Type Image Family Image Name
Release constellation constellation-v<major>-<minor>-<patch>
Debug constellation-debug-v<major>-<minor>-<patch> constellation-<commit-timestamp>
Branch constellation-<branch-name> constellation-<commit-timestamp>

Example:

Type Image Family Image Name
Release constellation constellation-v1-5-0
Debug constellation-v1-5-0 constellation-20220912123456
Branch constellation-ref-cli constellation-20220912123456

Azure

Type Gallery Image Definition Image Version
Release Constellation constellation <major>.<minor>.<patch>
Debug Constellation_Debug v<major>.<minor>.<patch> <commit-timestamp>
Branch Constellation_Testing <branch-name> <commit-timestamp>

Example:

Type Image Definition Image Version
Release constellation 1.5.0
Debug v1.5.0 2022.0912.123456
Branch ref-cli 2022.0912.123456