mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-02 10:22:17 +08:00
Bumps the actions group in /.github/workflows with 3 updates: [actions/checkout](https://github.com/actions/checkout), [github/codeql-action](https://github.com/github/codeql-action) and [actions/setup-python](https://github.com/actions/setup-python). Updates `actions/checkout` from 6.0.1 to 6.0.2 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](8e8c483db8...de0fac2e45) Updates `github/codeql-action` from 4.31.10 to 4.32.0 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](cdefb33c0f...b20883b0cd) Updates `actions/setup-python` from 6.1.0 to 6.2.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](83679a892e...a309ff8b42) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: github/codeql-action dependency-version: 4.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: actions/setup-python dependency-version: 6.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
114 lines
4.9 KiB
YAML
114 lines
4.9 KiB
YAML
# This workflow is inspired by `run-integration-tests-bluegreen-ingress.yml` and introduces namespace-specific testing for manifests.
|
|
# It ensures deployments respect manifest-defined namespaces and tests deployments to multiple namespaces.
|
|
name: Minikube Integration Tests - Namespace Optional
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- 'releases/*'
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'releases/*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
run-integration-test:
|
|
name: Namespace Optional Tests
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
KUBECONFIG: /home/runner/.kube/config
|
|
NAMESPACE1: integration-test-namespace1-${{ github.run_id }}
|
|
NAMESPACE2: integration-test-namespace2-${{ github.run_id }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- uses: ./.github/actions/minikube-setup
|
|
name: Setup Minikube Environment
|
|
timeout-minutes: 5
|
|
|
|
- name: Create namespaces for tests
|
|
run: |
|
|
kubectl create ns ${{ env.NAMESPACE1 }}
|
|
kubectl create ns ${{ env.NAMESPACE2 }}
|
|
kubectl create ns test-namespace
|
|
|
|
- name: Cleaning any previously created items
|
|
run: |
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE1 }}
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'all' ${{ env.NAMESPACE2 }}
|
|
|
|
# This tests whether the deployment respects the namespace defined in the manifest instead of defaulting to "default" when namespace is not provided.
|
|
- name: Test - Handles namespace correctly based on manifest
|
|
uses: ./
|
|
with:
|
|
images: nginx
|
|
manifests: |
|
|
test/integration/manifests/test_with_ns.yaml
|
|
test/integration/manifests/test_no_ns.yaml
|
|
action: deploy # Deploys manifests to specified namespaces or uses the namespace defined in the manifest
|
|
|
|
- name: Verify Deployment - test_with_ns.yaml (test-namespace)
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py \
|
|
namespace=test-namespace \
|
|
kind=Deployment \
|
|
name=test-deployment \
|
|
containerName=nginx \
|
|
labels=app:test-app,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_Namespace_Optional \
|
|
selectorLabels=app:test-app
|
|
|
|
- name: Verify Deployment - test_no_ns.yaml (default namespace)
|
|
run: |
|
|
python test/integration/k8s-deploy-test.py \
|
|
namespace=default \
|
|
kind=Deployment \
|
|
name=test-deployment-no-ns \
|
|
containerName=nginx \
|
|
labels=app:test-app,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_Namespace_Optional \
|
|
selectorLabels=app:test-app
|
|
|
|
# This tests whether the deployment works when a file is deployed to two different provided namespaces.
|
|
- name: Test - Deploys the resource to namespace1
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE1 }}
|
|
images: nginx
|
|
manifests: |
|
|
test/integration/manifests/test_no_ns.yaml
|
|
action: deploy
|
|
|
|
- name: Test - Deploys the resource to namespace2
|
|
uses: ./
|
|
with:
|
|
namespace: ${{ env.NAMESPACE2 }}
|
|
images: nginx
|
|
manifests: |
|
|
test/integration/manifests/test_no_ns.yaml
|
|
action: deploy
|
|
|
|
- name: Verify Deployments in NAMESPACE1 & NAMESPACE2
|
|
run: |
|
|
for ns in ${{ env.NAMESPACE1 }} ${{ env.NAMESPACE2 }}; do
|
|
python test/integration/k8s-deploy-test.py \
|
|
namespace=$ns \
|
|
kind=Deployment \
|
|
name=test-deployment-no-ns \
|
|
containerName=nginx \
|
|
labels=app:test-app,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_Namespace_Optional \
|
|
selectorLabels=app:test-app
|
|
done
|
|
|
|
- name: Cleanup
|
|
run: |
|
|
echo "Cleaning up resources..."
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'test-deployment' test-namespace
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'test-deployment-no-ns' ${{ env.NAMESPACE1 }}
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'test-deployment-no-ns' ${{ env.NAMESPACE2 }}
|
|
python test/integration/k8s-deploy-delete.py 'Deployment' 'test-deployment-no-ns' default
|
|
|
|
kubectl delete ns ${{ env.NAMESPACE1 }}
|
|
kubectl delete ns ${{ env.NAMESPACE2 }}
|
|
kubectl delete ns test-namespace
|
|
rm -rf test_with_ns.yaml test_no_ns.yaml
|