-
Notifications
You must be signed in to change notification settings - Fork 5
219 lines (215 loc) · 6.81 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
name: CI
on:
push:
branches:
- develop
- release*
tags: [v*]
paths-ignore:
- README.md
- CHANGELOG.md
- LICENSE
pull_request:
# Sequence of patterns matched against refs/heads
branches:
- develop
- release*
paths-ignore:
- README.md
- CHANGELOG.md
- LICENSE
env:
PROJECT: 'focal-freedom-236620'
IMAGE_NAME: 'operator'
GKE_CLUSTER: 'iofogctl-ci'
GKE_ZONE: 'us-central1-a'
controller_image: 'ghcr.io/eclipse-iofog/controller:3.0.4-53'
enterprise_image: 'gcr.io/focal-freedom-236620/enterprise-controller:master'
agent_image: 'ghcr.io/eclipse-iofog/agent:3.0.1-24'
operator_image: 'gcr.io/focal-freedom-236620/operator:develop'
kubelet_image: 'gcr.io/focal-freedom-236620/kubelet:develop'
port_manager_image: 'gcr.io/focal-freedom-236620/port-manager:develop'
router_image: 'gcr.io/focal-freedom-236620/router:develop'
router_arm_image: 'gcr.io/focal-freedom-236620/router-arm:develop'
proxy_image: 'gcr.io/focal-freedom-236620/proxy:3.0.0-beta1'
proxy_arm_image: 'gcr.io/focal-freedom-236620/proxy-arm:develop'
iofog_agent_version: '0.0.0-dev'
controller_version: '0.0.0-dev'
version:
agent_vm_list:
controller_vm:
jobs:
Build:
runs-on: ubuntu-20.04
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
name: Build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.18'
cache: false
- run: go version
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
args: --timeout=5m0s
- name: Run bootstrap
run: PIPELINE=1 script/bootstrap.sh
- run: make test
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: v0.0.0
- name: Set image tag
shell: bash
id: tags
run: |
if [[ ${{ github.ref_name }} =~ ^v.* ]] ; then
echo "VERSION=${{ github.ref_name }}" >> "${GITHUB_OUTPUT}"
else
echo "VERSION=${{ steps.previoustag.outputs.tag }}-dev" >> "${GITHUB_OUTPUT}"
fi
- name: Get image tag
run: |
echo ${{ steps.tags.outputs.VERSION }}
- name: iofogctl build packages GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: 1.1.0
args: --snapshot --rm-dist --debug --config ./.goreleaser-iofogctl.yml
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: iofogctl
path: ${{ github.workspace }}/dist
Test:
needs: Build
runs-on: ubuntu-20.04
permissions:
contents: 'read'
id-token: 'write'
packages: 'read'
steps:
- uses: actions/checkout@v4
- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
- name: 'Pull develop ghcr docker image'
run: |
docker pull ${{ env.controller_image }}
docker pull ${{ env.agent_image }}
- uses: actions/download-artifact@v2
with:
name: iofogctl
- run: ls
- name: Prepare iofogctl binary
shell: bash
run: |
sudo cp ${{ github.workspace }}//build_linux_linux_amd64/iofogctl /usr/local/bin/
sudo cp ${{ github.workspace }}//build_linux_linux_amd64/iofogctl /usr/local/bin/
sudo chmod 0755 /usr/local/bin/iofogctl
- run: sudo apt-get install -y jq
- name: Verify iofogctl
run: |
which iofogctl
iofogctl version
- run: ./pipeline/steps/configure-env.sh
- name: Install test deps
shell: bash
run: |
git clone https://github.com/bats-core/bats-core.git && cd bats-core && git checkout tags/v1.1.0 && sudo ./install.sh /usr/local
sudo npm i -g tap-junit
- name: Run smoke test
run: test/run.bash smoke
- name: Run functional Test
shell: bash
run: |
set -o pipefail
test/run.bash local | tee test/conf/results-local.tap
- name: 'Convert test output from TAP to JUnit'
shell: bash
run: |
tap-junit -i test/conf/results-local.tap -o test/conf -s Local -n results-local.xml || true
Publish_Iofogctl_Dev:
needs: [Build, Test]
if: ${{ github.ref_name == 'develop' || startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
name: Publish Iofogctl Dev
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.18'
cache: false
- name: Get image tag
run: |
echo ${{ needs.Build.outputs.VERSION }}
- name: iofogctl build packages GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: 1.1.0
args: --snapshot --rm-dist --debug --config ./.goreleaser-iofogctl-dev.yml
env:
VERSION: ${{ needs.Build.outputs.VERSION }}
- name: Install Packagecloud cli
run: go install github.com/edgeworx/[email protected]
- run: ./.packagecloud-publish.sh
continue-on-error: true
env:
PACKAGECLOUD_TOKEN: ${{ secrets.packagecloud_token }}
PACKAGECLOUD_REPO: "iofog/iofogctl-snapshots"
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: iofogctl_dev
path: ${{ github.workspace }}/dist
Publish_Iofogctl_Prod:
needs: [Build, Test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
name: Publish Iofogctl Prod
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.18'
cache: false
- name: iofogctl build packages GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: 1.1.0
args: --rm-dist --debug --config ./.goreleaser-iofogctl.yml
env:
VERSION: ${{ needs.Build.outputs.VERSION }}
- name: Install Packagecloud cli
run: go install github.com/edgeworx/[email protected]
- run: ./.packagecloud-publish.sh
continue-on-error: true
env:
PACKAGECLOUD_TOKEN: ${{ secrets.packagecloud_token }}
PACKAGECLOUD_REPO: "iofog/iofogctl"
GITHUB_TOKEN: ${{ github.token }}