1313env :
1414 DOCKER_FILE_PATH : Dockerfile
1515 GOLANG_VERSION : 1.18
16- KUBERNETES_VERSION : " 1.23.5 "
17- KIND_VERSION : " 0.16 .0"
16+ HELM_VERSION : v3.8.2
17+ KIND_VERSION : " v0.17 .0"
1818
1919jobs :
2020 build :
2121 runs-on : ubuntu-latest
22- name : Build
23- if : " ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') "
22+ name : Pull Request
23+
2424 steps :
2525 - name : Check out code
26- uses : actions/checkout@v2
26+ uses : actions/checkout@v3
2727 with :
2828 ref : ${{github.event.pull_request.head.sha}}
2929
3030 - name : Set up Go
31- id : go
32- uses : actions/setup-go@v2
31+ uses : actions/setup-go@v3
3332 with :
3433 go-version : ${{ env.GOLANG_VERSION }}
3534
3635 - name : Lint
37- uses : golangci/golangci-lint-action@v2.5.2
36+ uses : golangci/golangci-lint-action@v3
3837 with :
39- version : v1.45.2
38+ version : v1.50.1
4039 only-new-issues : false
4140 args : --timeout 10m
4241
42+ # Set up helm binary
43+ - name : Set up Helm
44+ uses : azure/setup-helm@v3
45+ with :
46+ version : ${{ env.HELM_VERSION }}
47+
4348 - name : Helm Lint
4449 run : |
4550 helm lint charts/ingressmonitorcontroller
4651
47- - name : Install kubectl
52+ - name : Install kind
53+ 54+ with :
55+ version : ${{ env.KIND_VERSION }}
56+
57+ - name : Check cluster info
4858 run : |
49- curl -LO "https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VERSION}/bin/linux/amd64/kubectl"
50- sudo install ./kubectl /usr/local/bin/ && rm kubectl
5159 kubectl version --short --client
52- kubectl version --short --client | grep -q ${KUBERNETES_VERSION}
53- - name : Install Kind
54- run : |
55- curl -L -o kind https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64
56- sudo install ./kind /usr/local/bin && rm kind
5760 kind version
5861 kind version | grep -q ${KIND_VERSION}
5962
60- - name : Create Kind Cluster
61- run : |
62- kind create cluster
63-
6463 - name : Set up Cluster
6564 run : |
6665 kubectl cluster-info
@@ -76,16 +75,20 @@ jobs:
7675 run : |
7776 sha=${{ github.event.pull_request.head.sha }}
7877 tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}"
79- echo "##[set-output name= GIT_TAG;] $(echo ${tag})"
78+ echo "GIT_TAG= $(echo ${tag})" >> $GITHUB_OUTPUT
8079
8180 - name : Set up QEMU
82- uses : docker/setup-qemu-action@v1
81+ uses : docker/setup-qemu-action@v2
8382
8483 - name : Set up Docker Buildx
85- uses : docker/setup-buildx-action@v1
84+ uses : docker/setup-buildx-action@v2
85+ with :
86+ driver-opts : |
87+ image=moby/buildkit:v0.9.3
88+ buildkitd-flags : --debug
8689
8790 - name : Login to Registry
88- uses : docker/login-action@v1
91+ uses : docker/login-action@v2
8992 with :
9093 username : ${{ secrets.STAKATER_DOCKERHUB_USERNAME }}
9194 password : ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }}
@@ -95,13 +98,12 @@ jobs:
9598 echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
9699
97100 - name : Build and Push Docker Image
98- uses : docker/build-push-action@v2
101+ uses : docker/build-push-action@v4
99102 with :
100103 context : .
101104 file : ${{ env.DOCKER_FILE_PATH }}
102105 pull : true
103106 push : true
104- build-args : BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }}
105107 cache-to : type=inline
106108 tags : |
107109 ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}
@@ -111,20 +113,13 @@ jobs:
111113 org.opencontainers.image.revision=${{ github.sha }}
112114
113115 - name : Comment on PR
114- uses : mshick/add-pr-comment@v1
115- env :
116- GITHUB_TOKEN : ${{ secrets.STAKATER_GITHUB_TOKEN }}
117- with :
118- message : ' @${{ github.actor }} Image is available for testing. `docker pull ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
119- allow-repeats : false
120-
121- - name : Notify Failure
122- if : failure()
123- uses : mshick/add-pr-comment@v1
116+ uses : mshick/add-pr-comment@v2
117+ if : always()
124118 env :
125119 GITHUB_TOKEN : ${{ secrets.STAKATER_GITHUB_TOKEN }}
126120 with :
127- message : ' @${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
121+ message-success : ' @${{ github.actor }} Image is available for testing. `docker pull ${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`'
122+ message-failure : ' @${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!'
128123 allow-repeats : false
129124
130125 - name : Notify Slack
@@ -134,5 +129,4 @@ jobs:
134129 status : ${{ job.status }}
135130 fields : repo,author,action,eventName,ref,workflow
136131 env :
137- GITHUB_TOKEN : ${{ secrets.STAKATER_GITHUB_TOKEN }}
138132 SLACK_WEBHOOK_URL : ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }}
0 commit comments