Skip to content

Commit 0d8d745

Browse files
AbakusWmlavacca
authored andcommitted
Integration pipeline update for Liqo Agent binary release
This commit adds the steps to create a Release object after a pushed tag and to upload the master version of the Liqo Agent binary to it. The 'set-env' workflow command is replaced with its new version
1 parent c2c4c46 commit 0d8d745

File tree

2 files changed

+56
-39
lines changed

2 files changed

+56
-39
lines changed

.github/workflows/go.yml

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
- scheduling-node-operator
2222
- discovery
2323
- peering-request-operator
24-
- tray-agent
2524
- secret-creation
2625
- init-pod-mutator
2726
- pod-mutator
@@ -37,11 +36,11 @@ jobs:
3736
- name: Set the commit to build
3837
run: |
3938
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
40-
echo "::set-env name=commit_ref::${{ github.event.pull_request.head.sha }}"
39+
echo "commit_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
4140
elif [ ! -z ${{ steps.get_version.outputs.VERSION }} ]; then
42-
echo "::set-env name=commit_ref::${{ steps.get_version.outputs.VERSION }}"
41+
echo "commit_ref=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_ENV
4342
else
44-
echo "::set-env name=commit_ref::${{ github.sha }}"
43+
echo "commit_ref=${{ github.sha }}" >> $GITHUB_ENV
4544
fi
4645
- name: Check out code into the Go module directory
4746
uses: actions/checkout@v2
@@ -94,21 +93,21 @@ jobs:
9493
- name: Set the commit to build
9594
run: |
9695
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
97-
echo "::set-env name=commit_ref::${{ github.event.pull_request.head.sha }}"
96+
echo "commit_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
9897
else
99-
echo "::set-env name=commit_ref::${{ github.sha }}"
98+
echo "commit_ref=${{ github.sha }}" >> $GITHUB_ENV
10099
fi
101100
- uses: actions/checkout@v2
102101
with:
103102
ref: "${{ env.commit_ref }}"
104103
- name: "Make scripts executable"
105104
run: chmod +x ./scripts/utils/*
106105
- name: "Set PR number"
107-
run: echo "::set-env name=branch_owner::`git log -1 --format='%ae' $commit_ref^!`"
106+
run: echo "branch_owner=`git log -1 --format='%ae' $commit_ref^!`"
108107
- name: "Install python dependencies"
109108
run: pip install requests
110109
- name: "Set branch name"
111-
run: echo "::set-env name=branch_name::`echo ${GITHUB_REF#refs/*/}`"
110+
run: echo "branch_name=`echo ${GITHUB_REF#refs/*/}`" >> $GITHUB_ENV
112111
- name: "Notify PR Event to Liqops"
113112
run: |
114113
curl -X POST https://api.github.com/repos/liqotech/${{ matrix.component }}/dispatches \
@@ -120,6 +119,29 @@ jobs:
120119
runs-on: ubuntu-latest
121120
needs: [build, test]
122121
steps:
122+
- name: Create release
123+
id: create_release
124+
uses: actions/create-release@v1
125+
with:
126+
tag_name: ${{ needs.test.outputs.release_version }}
127+
release_name: ${{ needs.test.outputs.release_version }}
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
130+
if: github.event_name == 'push' && github.event.repository.full_name == 'liqotech/liqo' && startsWith(github.ref, 'refs/tags/v')
131+
- name: Download Agent artifact
132+
uses: actions/download-artifact@v2
133+
with:
134+
name: agent_artifact
135+
if: github.event_name == 'push' && github.event.repository.full_name == 'liqotech/liqo' && startsWith(github.ref, 'refs/tags/v')
136+
- name: Upload Agent asset to release
137+
uses: shogo82148/actions-upload-release-asset@v1
138+
with:
139+
upload_url: ${{ steps.create_release.outputs.upload_url }}
140+
asset_path: liqo-agent.tar.gz
141+
asset_content_type: application/gzip
142+
github_token: ${{ secrets.CI_TOKEN }}
143+
overwrite: true
144+
if: github.event_name == 'push' && github.event.repository.full_name == 'liqotech/liqo' && startsWith(github.ref, 'refs/tags/v')
123145
- uses: 8398a7/action-slack@v2
124146
with:
125147
status: ${{ job.status }}
@@ -128,28 +150,31 @@ jobs:
128150
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }} # required
129151
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
130152
if: always() && github.ref == 'refs/heads/master' # Pick up events even if the job fails or is canceled.
153+
131154
test:
132155
name: Test Launch
133156
runs-on: ubuntu-20.04
157+
outputs:
158+
release_version: ${{ steps.get_version.outputs.VERSION }}
134159
steps:
135160
- name: Get the version
136161
id: get_version
137-
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
162+
run: echo "::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)"
138163
if: github.event.repository.full_name == 'liqotech/liqo' && startsWith(github.ref, 'refs/tags/v')
139164

140165
- name: Set the commit to build
141166
run: |
142167
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
143-
echo "::set-env name=commit_ref::${{ github.event.pull_request.head.sha }}"
168+
echo "commit_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
144169
elif [ ! -z ${{ steps.get_version.outputs.VERSION }} ]; then
145-
echo "::set-env name=commit_ref::${{ steps.get_version.outputs.VERSION }}"
170+
echo "commit_ref=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_ENV
146171
else
147-
echo "::set-env name=commit_ref::${{ github.sha }}"
172+
echo "commit_ref=${{ github.sha }}" >> $GITHUB_ENV
148173
fi
149-
- name: Set up Go 1.13
174+
- name: Set up Go 1.14
150175
uses: actions/setup-go@v2
151176
with:
152-
go-version: 1.13
177+
go-version: 1.14
153178
id: go
154179
- name: Check out code into the Go module directory
155180
uses: actions/checkout@v2
@@ -167,10 +192,26 @@ jobs:
167192
run: |
168193
go get -u github.com/ory/go-acc
169194
- name: install tray-agent dependencies
170-
run: sudo apt update && sudo apt-get install gcc libgtk-3-dev libappindicator3-dev libwebkit2gtk-4.0-dev xclip
195+
run: |
196+
export DEBIAN_FRONTEND=noninteractive
197+
sudo apt update && sudo apt -y upgrade
198+
sudo apt-get -y install gcc libgtk-3-dev libappindicator3-dev libxapp-dev libwebkit2gtk-4.0-dev xclip
171199
- run: go-acc ./... --ignore liqo/test/e2e
172200
- name: Send coverage
173201
uses: shogo82148/actions-goveralls@v1
174202
with:
175203
path-to-profile: coverage.txt
204+
- name: Build Agent asset
205+
run: |
206+
GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build ./cmd/tray-agent/liqo-agent.go
207+
tar -czf liqo-agent.tar.gz liqo-agent
208+
if: github.event_name == 'push' && github.event.repository.full_name == 'liqotech/liqo' && startsWith(github.ref, 'refs/tags/v')
209+
- name: Upload Agent artifact
210+
uses: actions/upload-artifact@v2
211+
with:
212+
name: agent_artifact
213+
path: liqo-agent.tar.gz
214+
retention-days: 1
215+
if-no-files-found: error
216+
if: github.event_name == 'push' && github.event.repository.full_name == 'liqotech/liqo' && startsWith(github.ref, 'refs/tags/v')
176217
if: github.event.pull_request.draft == false

build/tray-agent/Dockerfile

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)