Skip to content

Commit

Permalink
Build e2e chart locally
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Mazzotti <[email protected]>
  • Loading branch information
anmazzotti committed Sep 25, 2024
1 parent 7ba0a1e commit 5519330
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 107 deletions.
110 changes: 7 additions & 103 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,86 +7,6 @@ concurrency:
cancel-in-progress: true

jobs:
prepare-build:
name: Wait for the PR project to build
runs-on: ubuntu-latest
outputs:
chart_name: ${{ steps.chart.outputs.chart_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Wait for OBS crds chart
uses: "./.github/actions/wait-commit-status"
with:
repository: ${{ github.repository }}
commit: ${{ github.event.pull_request.head.sha }}
context: "OBS: elemental-operator-crds-helm - charts/x86_64"
status: "success"
interval: 60
retries: 10
- name: Wait for OBS operator chart
uses: "./.github/actions/wait-commit-status"
with:
repository: ${{ github.repository }}
commit: ${{ github.event.pull_request.head.sha }}
context: "OBS: elemental-operator-helm - charts/x86_64"
status: "success"
interval: 60
retries: 10
- name: Wait for OBS elemental-operator package
uses: "./.github/actions/wait-commit-status"
with:
repository: ${{ github.repository }}
commit: ${{ github.event.pull_request.head.sha }}
context: "OBS: elemental-operator - standard/x86_64"
status: "success"
interval: 60
retries: 30
- name: Wait for OBS seedimage-builder build
uses: "./.github/actions/wait-commit-status"
with:
repository: ${{ github.repository }}
commit: ${{ github.event.pull_request.head.sha }}
context: "OBS: seedimage-builder - containers/x86_64"
status: "success"
interval: 60
retries: 30
- name: Wait for OBS operator-image build
uses: "./.github/actions/wait-commit-status"
with:
repository: ${{ github.repository }}
commit: ${{ github.event.pull_request.head.sha }}
context: "OBS: operator-image - containers/x86_64"
status: "success"
interval: 60
retries: 30
- name: Pull chart for PR
env:
PR_NUMBER: ${{ github.event.number }}
OPERATOR_CHART: rancher/elemental-operator-chart
CRDS_CHART: rancher/elemental-operator-crds-chart
run: |
set -x
B_REPO=registry.opensuse.org/isv/rancher/elemental/pr/rancher/elemental-operator/pr-${PR_NUMBER}/charts
mkdir -p build
helm pull -d build oci://${B_REPO}/${CRDS_CHART}
helm pull -d build oci://${B_REPO}/${OPERATOR_CHART}
- name: Set chart output
id: chart
run: |
set -x
FILE=$(find . -type f -name "elemental-operator-chart-[1-9]*.tgz" -print)
CHART=$(basename $FILE)
echo "chart_name=$CHART" >> $GITHUB_OUTPUT
- name: Upload chart
uses: actions/upload-artifact@v4
with:
name: chart
path: build/*.tgz
overwrite: true

e2e-tests:
continue-on-error: true
strategy:
Expand All @@ -96,39 +16,23 @@ jobs:
replicas: ["1"]
rancherVersion : ["2.8.5"]
runs-on: ubuntu-latest
needs: prepare-build
name: k8s ${{ matrix.kubernetes }} - Rancher ${{ matrix.rancherVersion }} - ${{ matrix.replicas }} replicas
env:
CHART: ${{ github.workspace }}/build/${{ needs.prepare-build.outputs.chart_name }}
OPERATOR_REPLICAS: ${{ matrix.replicas }}
RANCHER_VERSION: ${{ matrix.rancherVersion }}
KUBE_VERSION: ${{ matrix.kubernetes }}
NGINX_VERSION: controller-v1.9.1
CERT_MANAGER_VERSION: v1.13.1
SYSTEM_UPGRADE_CONTROLLER_VERSION: v0.13.1
steps:
- uses: actions/checkout@v4
- name: Download chart
uses: actions/download-artifact@v4
- name: Setup full cluster
run: LOCAL_BUILD=true make setup-full-cluster
- name: Upload chart
uses: actions/upload-artifact@v4
with:
name: chart
path: build
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-test-go-${{ hashFiles('**/go.sum') }}
- name: Install kind
uses: helm/kind-action@v1
with:
cluster_name: operator-e2e
node_image: kindest/node:${{ matrix.kubernetes }}
path: build/*.tgz
overwrite: true
- name: e2e tests
run: make e2e-tests
- name: Archive artifacts
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ var _ = BeforeSuite(func() {
}

By("Deploying elemental-operator chart dependencies", func() {
By("installing nginx", func() {
By("installing nginx: "+e2eCfg.NginxVersion, func() {
if isAlreadyInstalled(nginxNamespace) {
By("already installed")
return
Expand All @@ -175,7 +175,7 @@ var _ = BeforeSuite(func() {
}, 5*time.Minute, 2*time.Second).Should(BeTrue())
})

By("installing cert-manager", func() {
By("installing cert-manager: "+e2eCfg.CertManagerVersion, func() {
if isAlreadyInstalled(certManagerNamespace) {
By("already installed")
return
Expand All @@ -199,7 +199,7 @@ var _ = BeforeSuite(func() {
}, 5*time.Minute, 2*time.Second).Should(BeTrue())
})

By("installing rancher", func() {
By("installing rancher: "+e2eCfg.RancherVersion, func() {
if isAlreadyInstalled(cattleSystemNamespace) {
By("already installed")
return
Expand Down Expand Up @@ -247,7 +247,7 @@ var _ = BeforeSuite(func() {
}, 5*time.Minute, 2*time.Second).Should(BeTrue())
})

By("installing system-upgrade-controller", func() {
By("installing system-upgrade-controller: "+e2eCfg.SystemUpgradeControllerVersion, func() {
resp, err := http.Get(e2eCfg.SystemUpgradeControllerURL)
Expect(err).ToNot(HaveOccurred())
defer resp.Body.Close()
Expand Down

0 comments on commit 5519330

Please sign in to comment.