Skip to content

Commit

Permalink
Execute kubernetes tests on image from current build
Browse files Browse the repository at this point in the history
  • Loading branch information
kuskoman committed Apr 14, 2023
1 parent 3e7f98a commit ab1d478
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 23 deletions.
75 changes: 52 additions & 23 deletions .github/workflows/go-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,6 @@ jobs:
working-directory: ./chart
run: helm template . > /dev/null

test-helm-integration:
name: Test integration with Helm chart
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 3.11.2

- name: Include current chart versions
working-directory: .helm/logstash-integration-test-chart
run: helm dependency update

- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.4.0

- name: Install Helm chart
working-directory: .helm/logstash-integration-test-chart
run: helm install --atomic --wait --timeout 15m --debug logstash-integration-test-chart .

test-integration:
name: Test integration with Prometheus
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -238,6 +215,16 @@ jobs:
- name: Build Docker image
run: make build-docker

- name: Package Docker image
run: docker save logstash-exporter:latest | gzip > logstash-exporter.tar.gz

- name: Upload Docker image as an artifact
uses: actions/upload-artifact@v3
with:
name: logstash-exporter-docker-image
path: logstash-exporter.tar.gz
retention-days: 1

- name: Login to GitHub registry
if: github.ref == 'refs/heads/master'
run: echo ${{ secrets.GH_PAT }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
Expand Down Expand Up @@ -270,6 +257,48 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.TAG_NAME }}

test-helm-integration:
name: Test integration with Helm chart
runs-on: ubuntu-20.04
needs:
- verify-helm-readme
- lint-helm-chart
- template-helm-chart
- build-linux-docker-image
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Download Docker image
uses: actions/download-artifact@v3
with:
name: logstash-exporter-docker-image
path: .helm/files

- name: Load Docker image
run: docker load -i .helm/files/logstash-exporter.tar.gz

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: 3.11.2

- name: Include current chart versions
working-directory: .helm/logstash-integration-test-chart
run: helm dependency update

- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.4.0
with:
cluster_name: kind-chart-testing

- name: Export Docker image to Kind cluster
run: kind load docker-image logstash-exporter:latest --name kind-chart-testing

- name: Install Helm chart
working-directory: .helm/logstash-integration-test-chart
run: helm install --atomic --wait --timeout 15m --debug logstash-integration-test-chart .

create-release:
name: Create GitHub release
runs-on: ubuntu-20.04
Expand Down
4 changes: 4 additions & 0 deletions .helm/logstash-integration-test-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ apache:
logstash-exporter:
enabled: true
fullnameOverride: logstash-exporter
image:
repository: logstash-exporter
tag: latest
pullPolicy: IfNotPresent

0 comments on commit ab1d478

Please sign in to comment.