@@ -33,38 +33,33 @@ jobs:
3333 - name : Install Go
3434 uses : actions/setup-go@v6
3535 with :
36- go-version : ${{ env.GO_VERSION }}
37- check-latest : true
36+ go-version-file : bin/kubectl-rabbitmq-plugin/go.mod
37+ cache-dependency-path : |
38+ bin/kubectl-rabbitmq-plugin/go.sum
3839
3940 - name : Install Carvel
4041 uses :
carvel-dev/[email protected] 4142 with :
4243 token : ${{ secrets.GITHUB_TOKEN }}
4344 only : ytt
4445
45- - name : Install Bats
46- run : |
47- git clone https://github.com/bats-core/bats-core.git "$HOME"/bats-core
48- cd "$HOME"/bats-core
49- sudo ./install.sh /usr/local
50-
5146 - name : Download Operator artifact
5247 uses : actions/download-artifact@v7
5348 with :
5449 name : operator_image
55- path : /tmp
50+ path : ${{ runner.temp }}
5651
5752 - name : Create KinD
5853 uses : helm/kind-action@v1
5954 with :
6055 cluster_name : cluster-operator-testing
6156 node_image : ${{ env.KIND_NODE_IMAGE }}
6257
63- - name : kubectl rabbitmq tests
58+ - name : Deploy dev Operator
6459 env :
6560 IMG : " rabbitmqoperator/cluster-operator:${{ needs.build_operator.outputs.image_tag }}"
6661 run : |
67- kind load image-archive /tmp /operator.tar --name cluster-operator-testing
62+ kind load image-archive ${{ runner.temp }} /operator.tar --name cluster-operator-testing
6863
6964 make manifests deploy-namespace-rbac
7065 kubectl kustomize config/crd | kubectl apply -f-
7469 -f config/ytt/never_pull.yaml \
7570 | kubectl apply -f-
7671
77- make kubectl-plugin-tests
72+ - name : Test kubectl plugin
73+ working-directory : bin/kubectl-rabbitmq-plugin
74+ run : make tests TEST_TAGS=integration
7875
7976 - name : Notify Google Chat
8077 if : ${{ failure() && github.event_name != 'pull_request' }}
8481 jobStatus : ${{ job.status }}
8582 title : Cluster Operator - RabbitMQ kubectl tests
8683
84+ build_kubectl_plugin :
85+ name : Build kubectl plugin
86+ runs-on : ubuntu-latest
87+ needs : kubectl_tests
88+ if : github.ref_type == 'tag'
89+ strategy :
90+ matrix :
91+ os : [darwin, linux]
92+ arch : [amd64, arm64]
93+ steps :
94+ - name : Check out code into the Go module directory
95+ uses : actions/checkout@v6
96+
97+ - name : Install Go
98+ uses : actions/setup-go@v6
99+ with :
100+ go-version-file : bin/kubectl-rabbitmq-plugin/go.mod
101+ cache-dependency-path : |
102+ bin/kubectl-rabbitmq-plugin/go.sum
103+
104+ - name : Build kubectl plugin
105+ working-directory : bin/kubectl-rabbitmq-plugin
106+ run : make build PLUGIN_VERSION=${{ github.ref_name }} GO_OS=${{ matrix.os }} GO_ARCH=${{ matrix.arch }}
107+
108+ - name : Compress kubectl plugin
109+ working-directory : bin/kubectl-rabbitmq-plugin
110+ run : tar -cvzf kubectl-rabbitmq-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz kubectl-rabbitmq-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}
111+
112+ - name : Upload kubectl plugin artifact
113+ uses : actions/upload-artifact@v6
114+ with :
115+ name : kubectl-rabbitmq-${{ matrix.os }}-${{ matrix.arch }}
116+ path : bin/kubectl-rabbitmq-plugin/kubectl-rabbitmq-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
117+
87118 unit_integration_tests :
88119 name : unit and integration tests
89120 runs-on : ubuntu-latest
@@ -517,30 +548,34 @@ jobs:
517548 release :
518549 name : Release to GitHub Releases
519550 runs-on : ubuntu-latest
520- if : startsWith( github.ref, 'refs/tags/v')
521- needs : [system_tests, test_doc_examples, test_upgrade]
551+ if : github.ref_type == 'tag'
552+ needs : [system_tests, test_doc_examples, test_upgrade, build_kubectl_plugin ]
522553 steps :
523- - name : Checkout
524- uses : actions/checkout@v6
525-
526554 - name : Get operator manifest
527555 uses : actions/download-artifact@v7
528556 with :
529557 name : operator-manifests
530558
559+ - name : Get kubectl plugin artefacts
560+ uses : actions/download-artifact@v7
561+ with :
562+ pattern : kubectl-rabbitmq-*
563+ merge-multiple : true
564+ path : bin/
565+
531566 - name : Get release header
532567 uses : actions/download-artifact@v7
533568 with :
534569 name : release-header
535570
536571 - name : Release
537572 uses : softprops/action-gh-release@v2
538- if : startsWith(github.ref, 'refs/tags/')
539573 with :
540574 files : |
541575 cluster-operator.yml
542576 cluster-operator-quay-io.yml
543577 cluster-operator-ghcr-io.yml
578+ bin/kubectl-rabbitmq-*
544579 generate_release_notes : true
545580 draft : true
546581 body_path : release-header.md
0 commit comments