From 66ab04e5ce5c8d50887a8586044aae9bac5a29ea Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Wed, 12 Apr 2023 14:42:24 +0200 Subject: [PATCH 1/3] Update expected output for helm chart customization --- tests/expected/multi-cluster/helm-external/bundle.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/expected/multi-cluster/helm-external/bundle.yaml b/tests/expected/multi-cluster/helm-external/bundle.yaml index 6926d88..7b77cbb 100644 --- a/tests/expected/multi-cluster/helm-external/bundle.yaml +++ b/tests/expected/multi-cluster/helm-external/bundle.yaml @@ -239,6 +239,7 @@ spec: matchLabels: env: dev helm: + chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz values: replication: false name: dev @@ -246,6 +247,7 @@ spec: matchLabels: env: test helm: + chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz values: replicas: 3 name: test @@ -253,6 +255,7 @@ spec: matchLabels: env: prod helm: + chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz values: replicas: 3 serviceType: LoadBalancer From dea19da689a11bc1f77547288ecb4f11c37db447 Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Wed, 12 Apr 2023 14:32:13 +0200 Subject: [PATCH 2/3] Update expected output for empty bundle removal --- .../helm-multi-chart/bundle.yaml | 236 ------------------ 1 file changed, 236 deletions(-) diff --git a/tests/expected/single-cluster/helm-multi-chart/bundle.yaml b/tests/expected/single-cluster/helm-multi-chart/bundle.yaml index 3839d87..54231d2 100644 --- a/tests/expected/single-cluster/helm-multi-chart/bundle.yaml +++ b/tests/expected/single-cluster/helm-multi-chart/bundle.yaml @@ -1,241 +1,5 @@ apiVersion: fleet.cattle.io/v1alpha1 kind: Bundle -metadata: - labels: - fleet.cattle.io/commit: fake - name: test - namespace: fleet-local -spec: - resources: - - content: "# Helm Multi-Chart Example\n\nThis example will deploy the [Kubernetes - sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) - application \npackaged as a Helm chart into the `fleet-helm-example` namespace.\nIt - will also deploy Rancher Monitoring helm charts into the `cattle-monitoring-system` - namespace.\n\n```yaml\nkind: GitRepo\napiVersion: fleet.cattle.io/v1alpha1\nmetadata:\n - \ name: helm\n namespace: fleet-local\nspec:\n repo: https://github.com/rancher/fleet-examples\n - \ paths:\n - single-cluster/helm-multi-chart\n```\n" - name: README.md - - content: | - apiVersion: v2 - name: guestbook - description: Sample application - version: 0.0.0 - appVersion: 0.0.0 - name: guestbook/Chart.yaml - - content: | - # This file and all contents in it are OPTIONAL. - - # The namespace this chart will be installed to, - # if not specified the chart will be installed to "default" - namespace: fleet-multi-chart-helm-example - - # Custom helm options - helm: - # The release name to use. If empty a generated release name will be used - releaseName: guestbook - - # The directory of the chart in the repo. Also any valid go-getter supported - # URL can be used there is specify where to download the chart from. - # If repo below is set this value if the chart name in the repo - chart: "" - - # An https to a valid Helm repository to download the chart from - repo: "" - - # Used if repo is set to look up the version of the chart - version: "" - - # Force recreate resource that can not be updated - force: false - - # How long for helm to wait for the release to be active. If the value - # is less that or equal to zero, we will not wait in Helm - timeoutSeconds: 0 - - # Custom values that will be passed as values.yaml to the installation - values: - replicas: 2 - name: guestbook/fleet.yaml - - content: | - apiVersion: apps/v1 - kind: Deployment - metadata: - name: frontend - spec: - selector: - matchLabels: - app: guestbook - tier: frontend - replicas: {{ .Values.replicas }} - template: - metadata: - labels: - app: guestbook - tier: frontend - spec: - containers: - - name: php-redis - image: gcr.io/google-samples/gb-frontend:v5 - resources: - requests: - cpu: 100m - memory: 100Mi - ports: - - containerPort: 80 - name: guestbook/templates/frontend-deployment.yaml - - content: | - apiVersion: v1 - kind: Service - metadata: - name: frontend - labels: - app: guestbook - tier: frontend - spec: - type: "{{ .Values.serviceType }}" - ports: - - port: 80 - selector: - app: guestbook - tier: frontend - name: guestbook/templates/frontend-service.yaml - - content: | - apiVersion: apps/v1 - kind: Deployment - metadata: - name: redis-master - spec: - selector: - matchLabels: - app: redis - role: master - tier: backend - replicas: 1 - template: - metadata: - labels: - app: redis - role: master - tier: backend - spec: - containers: - - name: master - image: registry.k8s.io/redis:e2e - resources: - requests: - cpu: 100m - memory: 100Mi - ports: - - containerPort: 6379 - name: guestbook/templates/redis-master-deployment.yaml - - content: | - apiVersion: v1 - kind: Service - metadata: - name: redis-master - labels: - app: redis - role: master - tier: backend - spec: - ports: - - port: 6379 - targetPort: 6379 - selector: - app: redis - role: master - tier: backend - name: guestbook/templates/redis-master-service.yaml - - content: | - {{ if .Values.replication }} - apiVersion: apps/v1 - kind: Deployment - metadata: - name: redis-slave - spec: - selector: - matchLabels: - app: redis - role: slave - tier: backend - replicas: 2 - template: - metadata: - labels: - app: redis - role: slave - tier: backend - spec: - containers: - - name: slave - image: gcr.io/google_samples/gb-redisslave:v2 - resources: - requests: - cpu: 100m - memory: 100Mi - ports: - - containerPort: 6379 - {{ end }} - name: guestbook/templates/redis-slave-deployment.yaml - - content: | - apiVersion: v1 - kind: Service - metadata: - name: redis-slave - labels: - app: redis - role: slave - tier: backend - spec: - ports: - - port: 6379 - selector: - app: redis - {{ if .Values.replication }} - role: slave - {{ else }} - role: master - {{ end }} - tier: backend - name: guestbook/templates/redis-slave-service.yaml - - content: | - replication: true - replicas: 1 - serviceType: NodePort - name: guestbook/values.yaml - - content: | - defaultNamespace: cattle-monitoring-system - helm: - releaseName: rancher-monitoring-crd - chart: rancher-monitoring-crd - repo: https://charts.rancher.io - version: 100.1.2+up19.0.3 - name: rancher-monitoring-crd/fleet.yaml - - content: | - defaultNamespace: cattle-monitoring-system - helm: - releaseName: rancher-monitoring - repo: https://charts.rancher.io - chart: rancher-monitoring - version: 100.1.2+up19.0.3 - diff: - comparePatches: - - apiVersion: admissionregistration.k8s.io/v1 - kind: MutatingWebhookConfiguration - name: rancher-monitoring-admission - operations: - - {"op":"remove", "path":"/webhooks/0/failurePolicy"} - - apiVersion: admissionregistration.k8s.io/v1 - kind: ValidatingWebhookConfiguration - name: rancher-monitoring-admission - operations: - - {"op":"remove", "path":"/webhooks/0/failurePolicy"} - name: rancher-monitoring/fleet.yaml - targets: - - clusterGroup: default - name: default -apiVersion: fleet.cattle.io/v1alpha1 -kind: Bundle metadata: labels: fleet.cattle.io/commit: fake From f07b2b55b35fd73327b416ea7dc3df97b87c4bcc Mon Sep 17 00:00:00 2001 From: Mario Manno Date: Wed, 12 Apr 2023 14:32:59 +0200 Subject: [PATCH 3/3] Add test workflow for branch with old releases --- .github/workflows/ci-0.5.yml | 44 ++++++++++++++++++++++++++++++++++++ .github/workflows/ci-0.6.yml | 42 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 8 +------ 3 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci-0.5.yml create mode 100644 .github/workflows/ci-0.6.yml diff --git a/.github/workflows/ci-0.5.yml b/.github/workflows/ci-0.5.yml new file mode 100644 index 0000000..ab96748 --- /dev/null +++ b/.github/workflows/ci-0.5.yml @@ -0,0 +1,44 @@ +name: CI v0.5 + +on: + schedule: + - cron: '0 5 * * *' + pull_request: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + fleet_version: + - v0.3.9 + - v0.4.0 + - v0.5.0 + + steps: + - + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: "release/v0.5" + - + uses: actions/cache@v3 + id: fleet-cli-cache + with: + path: /home/runner/.local/bin + key: ${{ runner.os }}-fleet-cli-${{ matrix.fleet_version }} + - + name: Download CLI + if: steps.fleet-cli-cache.outputs.cache-hit != 'true' + run: | + mkdir -p /home/runner/.local/bin + wget -nv "https://github.com/rancher/fleet/releases/download/${{ matrix.fleet_version }}/fleet-linux-amd64" + mv fleet-linux-amd64 /home/runner/.local/bin/fleet + chmod +x /home/runner/.local/bin/fleet + - + name: Test + run: | + tests/test.sh diff --git a/.github/workflows/ci-0.6.yml b/.github/workflows/ci-0.6.yml new file mode 100644 index 0000000..49a2a87 --- /dev/null +++ b/.github/workflows/ci-0.6.yml @@ -0,0 +1,42 @@ +name: CI v0.6 + +on: + schedule: + - cron: '0 5 * * *' + pull_request: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + fleet_version: + - "v0.6.0" + + steps: + - + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: "release/v0.6" + - + uses: actions/cache@v3 + id: fleet-cli-cache + with: + path: /home/runner/.local/bin + key: ${{ runner.os }}-fleet-cli-${{ matrix.fleet_version }} + - + name: Download CLI + if: steps.fleet-cli-cache.outputs.cache-hit != 'true' + run: | + mkdir -p /home/runner/.local/bin + wget -nv "https://github.com/rancher/fleet/releases/download/${{ matrix.fleet_version }}/fleet-linux-amd64" + mv fleet-linux-amd64 /home/runner/.local/bin/fleet + chmod +x /home/runner/.local/bin/fleet + - + name: Test + run: | + tests/test.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 123705d..204bc3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,8 +4,6 @@ on: schedule: - cron: '0 5 * * *' pull_request: - paths-ignore: - - '*.md' workflow_dispatch: jobs: @@ -16,11 +14,7 @@ jobs: fail-fast: false matrix: fleet_version: - - v0.3.9 - - v0.4.0 - - v0.5.0 - # expected data needs to be updated, since 0.6 supports helm charts in target customizations - #- v0.6.0-rc.1 + - "v0.7.0-AGENT-rc.1" steps: -