2
2
on :
3
3
push :
4
4
branches :
5
+ - main
5
6
- develop
6
7
- release*
7
8
tags : [v*]
11
12
- LICENSE
12
13
pull_request :
13
14
# Sequence of patterns matched against refs/heads
14
- branches :
15
+ branches :
16
+ - main
15
17
- develop
16
18
- release*
17
19
paths-ignore :
18
20
- README.md
19
21
- CHANGELOG.md
20
22
- LICENSE
21
23
env :
22
- PROJECT : ' focal-freedom-236620'
23
24
IMAGE_NAME : ' operator'
24
- GKE_CLUSTER : ' iofogctl-ci'
25
- GKE_ZONE : ' us-central1-a'
26
25
27
26
jobs :
28
27
Operator :
36
35
- uses : actions/checkout@v3
37
36
with :
38
37
fetch-depth : 0
39
- - uses : actions/setup-go@v4
40
- with :
41
- go-version : ' 1.19'
42
- - run : go version
43
- - name : golangci-lint
44
- uses : golangci/golangci-lint-action@v3
45
- with :
46
- version : v1.50.1
47
- args : --timeout=5m0s
48
- - uses : azure/setup-kubectl@v3
49
- id : install
50
- - name : Set up Kustomize
51
- run : |-
52
- curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
53
- chmod u+x ./kustomize
54
- - run : sudo make bats
38
+
55
39
- name : ' Get Previous tag'
56
40
id : previoustag
57
41
uses : " WyriHaximus/github-action-get-previous-tag@v1"
@@ -76,73 +60,31 @@ jobs:
76
60
service_account_key : ${{ secrets.GKE_SA_KEY }}
77
61
project_id : ${{ env.PROJECT }}
78
62
79
- # Get the GKE credentials so we can deploy to the cluster
80
- - uses : google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
81
- with :
82
- cluster_name : ${{ env.GKE_CLUSTER }}
83
- location : ${{ env.GKE_ZONE }}
84
- credentials : ${{ secrets.GKE_SA_KEY }}
85
63
- name : Login to Github Container Registry
64
+
86
65
uses : docker/login-action@v2
87
66
with :
88
67
registry : " ghcr.io"
89
68
username : ${{ github.actor }}
90
- password : ${{ github.token }}
69
+ password : ${{ secrets.PAT }}
91
70
92
71
- name : Build and Push to ghcr
72
+
93
73
uses : docker/build-push-action@v3
94
74
id : build_push_ghcr
95
75
with :
96
- file : ' ./ Dockerfile'
76
+ file : Dockerfile
97
77
push : true
78
+ outputs : type=image,name=target,annotation-index.org.opencontainers.image.description=operator
98
79
tags : |
99
- ghcr.io/eclipse-iofog/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.VERSION }}
100
- ghcr.io/eclipse-iofog/${{ env.IMAGE_NAME }}:latest
101
- context : ' ./'
102
-
103
- - name : Build and Push to GCR
104
- if : ${{ steps.tags.outcome }} == 'success'
105
- id : build_push_gcr
106
- uses : RafikFarhad/push-to-gcr-github-action@v5-beta
107
- with :
108
- gcloud_service_key : ${{ secrets.GCLOUD_SERVICE_KEY }}
109
- registry : gcr.io
110
- project_id : ${{ env.PROJECT }}
111
- image_name : ${{ env.IMAGE_NAME }}
112
- image_tag : latest, ${{ steps.tags.outputs.VERSION }}
113
- dockerfile : ' ./Dockerfile'
114
- context : ' ./'
80
+ ghcr.io/datasance/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.VERSION }}
81
+ ghcr.io/datasance/${{ env.IMAGE_NAME }}:latest
82
+ ghcr.io/datasance/${{ env.IMAGE_NAME }}:main
115
83
116
- - name : Kustomize
117
- shell : bash
118
- run : |
119
- set -e
120
- IMAGE="gcr.io/focal-freedom-236620/operator:${{ steps.tags.outputs.VERSION }}"
121
- cd config/operator
122
- kustomize edit set image "$IMAGE"
123
- kustomize build . > /tmp/deployment.yaml
124
- cp /tmp/deployment.yaml ./deployment.yaml
125
- cat ./deployment.yaml | grep "image: $IMAGE"
126
-
127
- - name : Feature tests
128
- shell : bash
129
- id : feature_test
130
- run : |
131
- set -e
132
- cp test/conf/env.sh.tpl test/conf/env.sh
133
- sed -i "s/<<NAMESPACE>>/${{ github.run_number }}/g" test/conf/env.sh
134
- sed -i "s/<<OP_VERSION>>/${{ steps.tags.outputs.VERSION }}/g" test/conf/env.sh
135
- make feature
136
- - name : Cleanup tests
137
- if : failure() && steps.feature_test.outcome == 'failure'
138
- shell : bash
139
- run : |
140
- set -e
141
- kubectl delete ns ${{ github.run_number }}
142
84
- run : mkdir -p ${{ github.workspace }}/artifact
143
85
- run : echo ${{ steps.tags.outputs.VERSION }} > ${{ github.workspace }}/artifact/version.txt
144
86
- name : Upload Artifact
145
- uses : actions/upload-artifact@v3
87
+ uses : actions/upload-artifact@v4
146
88
with :
147
89
name : operator
148
90
path : ${{ github.workspace }}/artifact/version.txt
0 commit comments