Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ jobs:
uses: actions/cache@v4
with:
path: |
./dev/.gocache
./dev/.gomodcache
./dev/build/.gocache
./dev/build/.gomodcache
key: dryrun-tests-go-cache-${{ hashFiles('**/go.sum') }}
restore-keys: |
dryrun-tests-go-cache-
Expand Down
226 changes: 226 additions & 0 deletions .github/workflows/v3-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
name: V3 E2E

on:
pull_request:
paths: &paths
- .github/workflows/v3-e2e.yaml
- api/**
- cmd/**
- dagger/**
- e2e/kots-release-install-v3/**
- e2e/licenses/ci-v3.yaml
- kinds/**
- local-artifact-mirror/**
- operator/**
- pkg/**
- pkg-new/**
- scripts/**
- utils/**
- web/**
- common.mk
- dagger.json
- go.mod
- go.sum
- Makefile
- versions.mk

push:
branches:
- main
paths: *paths

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: write

jobs:
output-vars:
name: Output variables
runs-on: ubuntu-latest
outputs:
git_version: ${{ steps.output_vars.outputs.git_version }}
k0s_minor_version: ${{ steps.output_vars.outputs.k0s_minor_version }}
ec_version: ${{ steps.output_vars.outputs.ec_version }}
app_version: ${{ steps.output_vars.outputs.app_version }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # necessary for getting the last tag

- name: Get git sha
id: git_sha
uses: ./.github/actions/git-sha

- name: Output variables
id: output_vars
run: |
GIT_VERSION=$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*')
echo "GIT_VERSION=\"$GIT_VERSION\""
echo "git_version=$GIT_VERSION" >> $GITHUB_OUTPUT

K0S_MINOR_VERSION=$(make print-K0S_MINOR_VERSION)
echo "K0S_MINOR_VERSION=\"$K0S_MINOR_VERSION\""
echo "k0s_minor_version=$K0S_MINOR_VERSION" >> $GITHUB_OUTPUT

EC_VERSION="$(./scripts/print-ec-version.sh "$GIT_VERSION" "$K0S_MINOR_VERSION")-v3"
echo "EC_VERSION=\"$EC_VERSION\""
echo "ec_version=$EC_VERSION" >> $GITHUB_OUTPUT

APP_VERSION="appver-dev-v3-${{ steps.git_sha.outputs.git_sha }}"
echo "APP_VERSION=\"$APP_VERSION\""
echo "app_version=$APP_VERSION" >> $GITHUB_OUTPUT

build-release:
name: Build release
needs:
- output-vars
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Cache embedded bins
uses: actions/cache@v4
with:
path: |
output/bins
key: bins-cache-${{ hashFiles('Makefile', 'versions.mk') }}
restore-keys: |
bins-cache-

- name: Setup go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: "**/*.sum"

- name: Setup node
uses: actions/setup-node@v6
with:
node-version-file: ./web/.nvmrc

- name: Setup oras
uses: oras-project/setup-oras@v1

- name: Setup crane
uses: imjasonh/setup-crane@v0.4

- name: Setup dagger
run: |
curl -fsSL https://dl.dagger.io/dagger/install.sh | sh
sudo mv ./bin/dagger /usr/local/bin/dagger

- name: Setup replicated cli
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download --repo replicatedhq/replicated --pattern '*linux_amd64.tar.gz' --output replicated.tar.gz
tar xf replicated.tar.gz replicated && rm replicated.tar.gz
mv replicated /usr/local/bin/replicated

- name: Free up runner disk space # this is much faster than .github/actions/free-disk-space
run: |
df -h
sudo rm -rf \
/usr/share/swift \
/usr/share/dotnet \
/usr/lib/jvm \
/usr/local/share/boost \
/usr/local/lib/heroku \
/usr/local/julia* \
/usr/local/.ghcup \
/usr/local/share/powershell \
/usr/local/bin/aliyun \
/usr/local/bin/azcopy \
/usr/local/bin/bicep \
/usr/local/bin/cpack \
/usr/local/bin/hub \
/usr/local/bin/minikube \
/usr/local/bin/packer \
/usr/local/bin/pulumi* \
/usr/local/bin/sam \
/usr/local/bin/stack \
/usr/local/bin/terraform \
/usr/local/bin/oc
df -h

- name: Build release
env:
K0S_MINOR_VERSION: "${{ needs.output-vars.outputs.k0s_minor_version }}"
VERSION: "${{ needs.output-vars.outputs.git_version }}"
EC_VERSION: ${{ needs.output-vars.outputs.ec_version }}
APP_VERSION: ${{ needs.output-vars.outputs.app_version }}
APP_CHANNEL: CI-V3
APP_CHANNEL_ID: 36LoGcOOLvEPFXQXCUsFub28Abi
APP_CHANNEL_SLUG: ci-v3
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_SECRET }}
AWS_REGION: "us-east-1"
S3_BUCKET: tf-staging-embedded-cluster-bin
REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
USE_CHAINGUARD: "1"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make e2e-v3-initial-release

e2e-headless-online:
name: E2E headless online
needs:
- output-vars
- build-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup dagger
run: |
curl -fsSL https://dl.dagger.io/dagger/install.sh | sh
sudo mv ./bin/dagger /usr/local/bin/dagger

- name: Run test
id: test
env:
APP_VERSION: ${{ needs.output-vars.outputs.app_version }}
KUBE_VERSION: "1.${{ needs.output-vars.outputs.k0s_minor_version }}"
CMX_REPLICATED_API_TOKEN: ${{ secrets.CMX_REPLICATED_API_TOKEN }}
CMX_SSH_PRIVATE_KEY: ${{ secrets.CMX_SSH_PRIVATE_KEY }}
run: |
# Run test and export results directory
dagger call e-2-e-run-headless \
--scenario=online \
--app-version=$APP_VERSION \
--kube-version=$KUBE_VERSION \
--license-file ./e2e/licenses/ci-v3.yaml \
--cmx-token=env://CMX_REPLICATED_API_TOKEN \
--ssh-key=env://CMX_SSH_PRIVATE_KEY \
export --path=./e2e-results

# Read result.json to extract test result
if [ -f ./e2e-results/result.json ]; then
success=$(jq -r '.Success' ./e2e-results/result.json)
echo "Test success: $success"

# Exit with test result
if [ "$success" = "true" ]; then
exit 0
else
error=$(jq -r '.Error' ./e2e-results/result.json)
echo "::error::E2E test failed: $error"
exit 1
fi
else
echo "::error::result.json not found in e2e-results directory"
exit 1
fi

- name: Upload test results
if: ${{ !cancelled() && hashFiles('./e2e-results/**') != '' }}
uses: actions/upload-artifact@v4
with:
name: e2e-results-headless-online
path: ./e2e-results/
20 changes: 8 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ cmd/installer/goods/bins/local-artifact-mirror:

output/bins/fio-%:
mkdir -p output/bins
docker build -t fio --build-arg FIO_VERSION=$(call split-hyphen,$*,1) --build-arg PLATFORM=$(OS)/$(call split-hyphen,$*,2) fio
docker rm -f fio && docker run --name fio fio
docker cp fio:/output/fio $@
docker rm -f fio
dagger call build-fio --version=$(call split-hyphen,$*,1) --arch=$(call split-hyphen,$*,2) export --path=$@
chmod +x $@
touch $@

.PHONY: cmd/installer/goods/bins/fio
Expand Down Expand Up @@ -184,22 +182,21 @@ output/bin/embedded-cluster-release-builder:
CGO_ENABLED=0 go build -o output/bin/embedded-cluster-release-builder e2e/embedded-cluster-release-builder/main.go

.PHONY: e2e-v3-initial-release
e2e-v3-initial-release: export ARCH = amd64
e2e-v3-initial-release: export ARCH ?= amd64
e2e-v3-initial-release: export UPLOAD_BINARIES = 1
e2e-v3-initial-release: export ENABLE_V3 = 1
e2e-v3-initial-release: initial-release

.PHONY: initial-release
initial-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)
initial-release: export APP_VERSION = appver-dev-$(call random-string)
initial-release: export EC_VERSION ?= $(VERSION)-$(CURRENT_USER)
initial-release: export APP_VERSION ?= appver-dev-$(call random-string)
initial-release: export RELEASE_YAML_DIR = $(if $(filter 1,$(ENABLE_V3)),e2e/kots-release-install-v3,e2e/kots-release-install)
initial-release: export V2_ENABLED = 0
initial-release: check-env-EC_VERSION check-env-APP_VERSION
UPLOAD_BINARIES=$(if $(UPLOAD_BINARIES),$(UPLOAD_BINARIES),0) \
./scripts/build-and-release.sh

.PHONY: rebuild-release
rebuild-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)
rebuild-release: export EC_VERSION ?= $(VERSION)-$(CURRENT_USER)
rebuild-release: export RELEASE_YAML_DIR = $(if $(filter 1,$(ENABLE_V3)),e2e/kots-release-install-v3,e2e/kots-release-install)
rebuild-release: check-env-EC_VERSION check-env-APP_VERSION
UPLOAD_BINARIES=$(if $(UPLOAD_BINARIES),$(UPLOAD_BINARIES),0) \
Expand All @@ -208,10 +205,9 @@ rebuild-release: check-env-EC_VERSION check-env-APP_VERSION

.PHONY: upgrade-release
upgrade-release: RANDOM_STRING = $(call random-string)
upgrade-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)-upgrade-$(RANDOM_STRING)
upgrade-release: export APP_VERSION = appver-dev-$(call random-string)-upgrade-$(RANDOM_STRING)
upgrade-release: export EC_VERSION ?= $(VERSION)-$(CURRENT_USER)-upgrade-$(RANDOM_STRING)
upgrade-release: export APP_VERSION ?= appver-dev-$(call random-string)-upgrade-$(RANDOM_STRING)
upgrade-release: export RELEASE_YAML_DIR = $(if $(filter 1,$(ENABLE_V3)),e2e/kots-release-upgrade-v3,e2e/kots-release-upgrade)
upgrade-release: export V2_ENABLED = 0
upgrade-release: check-env-EC_VERSION check-env-APP_VERSION
UPLOAD_BINARIES=$(if $(UPLOAD_BINARIES),$(UPLOAD_BINARIES),1) \
./scripts/build-and-release.sh
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,17 @@ The V3 installer includes a Dagger-based E2E test framework that provides portab

**Quick Start:**
```bash
# Provision a test VM
make e2e-v3-initial-release

dagger call with-one-password --service-account=env:OP_SERVICE_ACCOUNT_TOKEN \
test-provision-vm string
e-2-e-run-headless \
--scenario=online \
--app-version=<app version> \
--kube-version=1.33 \
--license-file=./local-dev/license.yaml
```

**Documentation:** See [dagger/e2e/README.md](dagger/e2e/README.md) for comprehensive E2E testing guide, including:
**Documentation:** See [dagger/README.md](dagger/README.md) for comprehensive E2E testing guide, including:
- Setup and prerequisites
- Available test scenarios
- Troubleshooting
Expand Down
1 change: 1 addition & 0 deletions common.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SHELL := /bin/bash
MAKEFLAGS += --no-print-directory

ARCH ?= $(shell go env GOARCH)
CURRENT_USER := $(if $(GITHUB_USER),$(GITHUB_USER),$(shell id -u -n))
Expand Down
8 changes: 5 additions & 3 deletions dagger.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "embedded-cluster",
"engineVersion": "v0.19.6",
"engineVersion": "v0.19.7",
"sdk": {
"source": "go"
},
"include": [
"!build",
"!cmd/installer/goods/bins/**",
"cmd/installer/goods/bins/.placeholder",
"!cmd/installer/goods/internal/bins/**",
"cmd/installer/goods/internal/bins/.placeholder",
"!dagger/embedded-cluster",
"!dev/build",
"!local-artifact-mirror/bin",
Expand Down Expand Up @@ -39,8 +41,8 @@
},
{
"name": "replicated",
"source": "github.com/replicatedhq/daggerverse/replicated@bf96fd742cf08239442ac155de7143bb7ef8f7fd",
"pin": "bf96fd742cf08239442ac155de7143bb7ef8f7fd"
"source": "github.com/replicatedhq/daggerverse/replicated@41123ddba40a9594307f24cb69ef6fbafda38e44",
"pin": "41123ddba40a9594307f24cb69ef6fbafda38e44"
}
],
"source": "dagger",
Expand Down
Loading
Loading