Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to build & release workflow to support E2E tests as release gate and fix some release issues #217

Merged
merged 8 commits into from
Jun 18, 2024
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
10 changes: 9 additions & 1 deletion .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
bump-chart-versions:
name: Bump chart versions
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'nobump')"
if: "!contains(github.event.head_commit.message, '[nobump]')"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -28,6 +28,7 @@ jobs:
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'

- name: Bump operators helm chart versions
id: bump-versions
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
Expand All @@ -54,6 +55,7 @@ jobs:
patch_version=$((${BASH_REMATCH[3]} + 1))
new_version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${patch_version}"
sed -i "s#^version:.*#version: ${new_version}#g" "${chart_path}"
echo "otterize-kubernetes-version=${new_version}" >> "$GITHUB_OUTPUT"
fi

- name: Setup git config
Expand All @@ -66,3 +68,9 @@ jobs:
git add .
git commit -m 'Bump chart versions [nobump]'
git push origin

- name: Tag version
run: |
tag="v${{ steps.bump-versions.outputs.otterize-kubernetes-version }}"
git tag -a ${tag}
git push origin ${tag}
74 changes: 0 additions & 74 deletions .github/workflows/e2e-test-azure-iam.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/e2e-test-database-integrations.yaml

This file was deleted.

92 changes: 90 additions & 2 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
types:
- opened
- synchronize
- reopened
- ready_for_review
- labeled
push:
branches:
- main
Expand All @@ -17,7 +20,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@v4.2.0

- name: Start minikube
uses: medyagh/setup-minikube@master
Expand All @@ -39,4 +42,89 @@ jobs:
kubectl delete namespace otterize-system # clean up

# installation
helm install otterize ./otterize-kubernetes -n otterize-system --wait --create-namespace --set global.telemetry.enabled=false
helm install otterize ./otterize-kubernetes -n otterize-system --wait --create-namespace --set global.telemetry.enabled=false

test-database-integrations:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Start minikube
uses: medyagh/setup-minikube@master

- name: Set up Helm
uses: azure/[email protected]

- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
token: ${{ secrets.GITHUB_TOKEN }}

- name: Helm dependency update
run: helm dep up ./otterize-kubernetes

- name: Run E2E tests - database integrations
run: |
cd tests
go test -v -json ./databases/... | tee gotest.log | gotestfmt

test-azure-integration:
if: contains(github.event.pull_request.labels.*.name, 'run-azure-e2e-tests') || (github.event_name == 'push' && github.ref == 'refs/heads/main')
timeout-minutes: 5
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }} # do not allow concurrent runs of this job
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in with Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Azure CLI script
uses: azure/CLI@v2
with:
inlineScript: |
az account show

- name: Set AKS context
uses: azure/aks-set-context@v4
with:
resource-group: 'otterizeGitHubActionsResourceGroup'
cluster-name: 'otterizeAzureIAME2EAKSCluster'

- name: Setup kubectl
uses: azure/setup-kubectl@v4

- name: Set up Helm
uses: azure/[email protected]

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: 1.22.1
cache-dependency-path: tests/go.sum

- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
# Optional: pass GITHUB_TOKEN to avoid rate limiting.
token: ${{ secrets.GITHUB_TOKEN }}

- name: Helm dependency update
run: helm dep up ./otterize-kubernetes

- name: Cleanup test namespaces
run: |
kubectl delete namespace otterize-tutorial-azure-iam --ignore-not-found=true --wait
kubectl delete namespace otterize-system --ignore-not-found=true --wait

- name: Run E2E tests - azure integrations
run: |
cd tests
go test -v -json ./azureiam/... | tee gotest.log | gotestfmt
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.22.1
cache-dependency-path: tests/go.sum
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/build.yaml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
name: Build & Release
name: release
on:
push:
branches:
- main
tags:
- v*

jobs:
e2e-tests:
uses: ./.github/workflows/e2e-tests.yaml
name: Trigger e2e tests

release:
runs-on: ubuntu-latest
needs:
- e2e-tests

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
Expand Down
3 changes: 3 additions & 0 deletions tests/azureiam/azureiam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func (s *AzureIAMTestSuite) installOtterizeForAzureIAM() {
"deployment": map[string]any{
"networkMapper": false,
},
"telemetry": map[string]interface{}{
"enabled": false,
},
},
}

Expand Down
3 changes: 3 additions & 0 deletions tests/databases/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ func (s *PostgresTestSuite) installOtterizeNetworkMapperDisabled() {
"deployment": map[string]interface{}{
"networkMapper": false,
},
"telemetry": map[string]interface{}{
"enabled": false,
},
},
}
s.InstallOtterizeHelmChart(values)
Expand Down
Loading