-
Notifications
You must be signed in to change notification settings - Fork 15
91 lines (81 loc) · 3.04 KB
/
build-go-tools.yml
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
# Ref: https://github.com/dmwm/dbs2go/blob/master/.github/workflows/build.yml
name: Build
on:
push:
tags:
- 'go-*.*.*'
paths-ignore:
- 'src/go/rucio-dataset-mon-go/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.20
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build
run: |
mkdir cmsmon-tools
cd src/go/MONIT
go build -o monit monit.go
go build -o alert alert.go
go build -o annotationManager annotationManager.go
go build -o datasources datasources.go
go build -o es_exporter es_exporter.go
mv monit alert annotationManager datasources es_exporter ../../../cmsmon-tools
cd ../NATS
go build -o dbs_vm dbs_vm.go
go build -o nats-pub nats-pub.go
go build -o nats-sub nats-sub.go
mv dbs_vm nats-pub nats-sub ../../../cmsmon-tools
cd ../../../
tar cfz cmsmon-tools.tar.gz cmsmon-tools
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload binaries
id: upload-cmsmon-tools
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cmsmon-tools.tar.gz
asset_name: cmsmon-tools.tar.gz
asset_content_type: application/octet-stream
# --- Build and push docker images ---
- name: Get git tag
id: get_tag
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
- name: Build cmsmon-alerts image
run: |
echo Image tag: ${{ steps.get_tag.outputs.tag }}
curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/cmsmon-alerts/Dockerfile
sed -i -e "s,ENV CMSMON_TAG=.*,ENV CMSMON_TAG=${{steps.get_tag.outputs.tag}},g" Dockerfile
docker build . --tag docker.pkg.github.com/dmwm/cmsmon-alerts/cmsmon-alerts
docker tag docker.pkg.github.com/dmwm/cmsmon-alerts/cmsmon-alerts registry.cern.ch/cmsmonitoring/cmsmon-alerts
- name: Login to registry.cern.ch
uses: docker/[email protected]
with:
registry: registry.cern.ch
username: ${{ secrets.CERN_LOGIN }}
password: ${{ secrets.CERN_TOKEN }}
- name: Publish cmsmon-alerts image to registry.cern.ch
uses: docker/build-push-action@v1
with:
username: ${{ secrets.CERN_LOGIN }}
password: ${{ secrets.CERN_TOKEN }}
registry: registry.cern.ch
repository: cmsmonitoring/cmsmon-alerts
tag_with_ref: true