Skip to content

Commit 12cd068

Browse files
authored
STF 1.5.6 release
- sg-core is now built on ubi9 - Update to Golang to 1.21.13 - Github Actions now run on ubuntu-latest - Pin Devstack version to stable/2024.2. New OpenStack versions deprecated the AMQP driver in oslo.messaging and this breaks sg-core testing - Parse custom labels from ceilometer metadata. Metrics without the user_metadata field are unchanged (current behavior is preserved). When the user_metadata field is present in the metric received from ceilometer it's parsed and each key=value pair is used as a separate metric label
2 parents cf0b14e + ad86e95 commit 12cd068

File tree

19 files changed

+84
-98
lines changed

19 files changed

+84
-98
lines changed

.github/workflows/integration.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Integration testing
22
env:
33
PROJECT_ROOT: /root/go/src/github.com/infrawatch/sg-core
4-
OPSTOOLS_REPO: https://raw.githubusercontent.com/infrawatch/sg-core/04dcb34edd2c234b378222d2f9a17e15c0dad936/build/repos/opstools.repo
4+
OPSTOOLS_REPO: https://raw.githubusercontent.com/infrawatch/sg-core/0d28a1c2f87bd64f2d67effcda926855af057a82/build/repos/opstools.repo
55

66
QDR_IMAGE: quay.io/interconnectedcloud/qdrouterd:1.17.0
77
QDR_VOLUME: "--volume=${{ github.workspace }}/ci/service_configs/qdr:/etc/qpid-dispatch:ro"
@@ -10,7 +10,7 @@ env:
1010
BRIDGE_IMAGE: quay.io/infrawatch/sg-bridge:latest
1111
BRIDGE_VOLUME: "--volume=${{ github.workspace }}/tmp:/tmp/sg-bridge:z"
1212

13-
TEST_IMAGE: registry.access.redhat.com/ubi8
13+
TEST_IMAGE: registry.access.redhat.com/ubi9
1414
TEST_PORT: "-p 3000:3000"
1515

1616
on: [push, pull_request]
@@ -22,7 +22,7 @@ jobs:
2222
env:
2323
QDR_CHANNEL: collectd/metrics
2424
BRIDGE_SOCKET: /tmp/sg-bridge/test-socket
25-
PROMETHEUS_IMAGE: prom/prometheus:latest
25+
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
2626
steps:
2727
- name: Checkout code
2828
uses: actions/checkout@v4.1.3
@@ -48,7 +48,7 @@ jobs:
4848
- name: Install devstack
4949
run: |
5050
SOURCE=$(pwd)
51-
git clone http://github.com/openstack/devstack /opt/stack/devstack
51+
git clone -b stable/2024.2 http://github.com/openstack/devstack /opt/stack/devstack
5252
pushd /opt/stack/devstack
5353
cp $SOURCE/ci/integration/metrics/local.conf .
5454
sudo apt-get update
@@ -62,8 +62,8 @@ jobs:
6262
id: bridge_branch
6363
continue-on-error: true
6464
run: |
65-
echo "${GITHUB_REF#refs/heads/}"
66-
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${GITHUB_REF#refs/heads/})"
65+
echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
66+
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}")"
6767
- name: Start sg-bridge from container image
6868
if: steps.bridge_branch.outcome != 'success'
6969
run: |
@@ -74,7 +74,7 @@ jobs:
7474
if: steps.bridge_branch.outcome == 'success'
7575
run: |
7676
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \
77-
-e GITHUB_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \
77+
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \
7878
--workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
7979
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh
8080
- name: Install collectd
@@ -118,7 +118,7 @@ jobs:
118118
env:
119119
QDR_CHANNEL: anycast/ceilometer/metering.sample
120120
BRIDGE_SOCKET: /tmp/sg-bridge/test-socket
121-
PROMETHEUS_IMAGE: prom/prometheus:latest
121+
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
122122
steps:
123123
- name: Checkout code
124124
uses: actions/checkout@v4.1.3
@@ -144,7 +144,7 @@ jobs:
144144
- name: Install devstack
145145
run: |
146146
SOURCE=$(pwd)
147-
git clone http://github.com/openstack/devstack /opt/stack/devstack
147+
git clone -b stable/2024.2 http://github.com/openstack/devstack /opt/stack/devstack
148148
pushd /opt/stack/devstack
149149
cp $SOURCE/ci/integration/metrics/local.conf .
150150
sudo apt-get update
@@ -158,8 +158,8 @@ jobs:
158158
id: bridge_branch
159159
continue-on-error: true
160160
run: |
161-
echo "${GITHUB_REF#refs/heads/}"
162-
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${GITHUB_REF#refs/heads/})"
161+
echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
162+
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}")"
163163
- name: Start sg-bridge from container image
164164
if: steps.bridge_branch.outcome != 'success'
165165
run: |
@@ -170,7 +170,7 @@ jobs:
170170
if: steps.bridge_branch.outcome == 'success'
171171
run: |
172172
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \
173-
-e GITHUB_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \
173+
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \
174174
--workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
175175
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh
176176
- name: Set Ceilometer pipelines to QDR output and restart notification agent
@@ -218,7 +218,7 @@ jobs:
218218
name: "[metrics] transport: socket(tcp); handler: ceilometer-metrics; application: prometheus"
219219
runs-on: ubuntu-22.04
220220
env:
221-
PROMETHEUS_IMAGE: prom/prometheus:latest
221+
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
222222
steps:
223223
- name: Checkout code
224224
uses: actions/checkout@v4.1.3
@@ -244,7 +244,7 @@ jobs:
244244
- name: Install devstack
245245
run: |
246246
SOURCE=$(pwd)
247-
git clone http://github.com/openstack/devstack /opt/stack/devstack
247+
git clone -b stable/2024.2 http://github.com/openstack/devstack /opt/stack/devstack
248248
pushd /opt/stack/devstack
249249
cp $SOURCE/ci/integration/metrics/local.conf .
250250
sudo apt-get update
@@ -323,8 +323,8 @@ jobs:
323323
id: bridge_branch
324324
continue-on-error: true
325325
run: |
326-
echo "${GITHUB_REF#refs/heads/}"
327-
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo ${GITHUB_REF#refs/heads/})"
326+
echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
327+
git ls-remote --exit-code --heads https://github.com/infrawatch/sg-bridge.git "$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}")"
328328
- name: Start sg-bridge from container image
329329
if: steps.bridge_branch.outcome != 'success'
330330
run: |
@@ -334,7 +334,7 @@ jobs:
334334
if: steps.bridge_branch.outcome == 'success'
335335
run: |
336336
docker run --name=sgbridge $BRIDGE_VOLUME -d -uroot --network host -e OPSTOOLS_REPO \
337-
-e GITHUB_REF -e BRIDGE_SOCKET --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
337+
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
338338
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_bridge.sh
339339
- name: Run rsyslog to produce log messages
340340
run: |

.github/workflows/tests.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CI
22
env:
33
PROJECT_ROOT: /root/go/src/github.com/infrawatch/sg-core
4-
OPSTOOLS_REPO: https://raw.githubusercontent.com/infrawatch/sg-core/04dcb34edd2c234b378222d2f9a17e15c0dad936/build/repos/opstools.repo
4+
OPSTOOLS_REPO: https://raw.githubusercontent.com/infrawatch/sg-core/0d28a1c2f87bd64f2d67effcda926855af057a82/build/repos/opstools.repo
55

66
LOKI_IMAGE: quay.io/infrawatch/loki:2.4.2
77
LOKI_VOLUME: "--volume=${{ github.workspace }}/ci/service_configs/loki:/etc/loki:ro"
@@ -10,32 +10,32 @@ env:
1010
ELASTIC_IMAGE: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
1111
ELASTIC_PORT: "-p 9200:9200 -p 9300:9300"
1212

13-
TEST_IMAGE: registry.access.redhat.com/ubi8
13+
TEST_IMAGE: registry.access.redhat.com/ubi9
1414
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
1515

1616
on: [push, pull_request]
1717

1818
jobs:
1919
golangci:
2020
name: Linting
21-
runs-on: ubuntu-20.04
21+
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/setup-go@v5
2424
with:
25-
go-version: '1.20'
25+
go-version: '1.21.13'
2626
- uses: actions/checkout@v4.1.3
2727
#- name: download libraries
2828
# run: go mod download
2929
- name: golangci-lint
30-
uses: golangci/golangci-lint-action@v3
30+
uses: golangci/golangci-lint-action@v6.1.0
3131
with:
3232
# Caching conflicts happen in GHA, so just disable for now
3333
skip-cache: true
3434
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
35-
version: v1.51
35+
version: v1.59.1
3636
unit-tests:
3737
name: Unit tests
38-
runs-on: ubuntu-20.04
38+
runs-on: ubuntu-latest
3939
steps:
4040
- name: Checkout code
4141
uses: actions/checkout@v4.1.3
@@ -72,12 +72,12 @@ jobs:
7272
path-to-profile: ${{ github.workspace }}/profile.cov
7373
image-build:
7474
name: Image build
75-
runs-on: ubuntu-20.04
75+
runs-on: ubuntu-latest
7676
steps:
7777
- uses: actions/checkout@v4.1.3
7878
- uses: actions/setup-go@v5
7979
with:
80-
go-version: '1.20'
80+
go-version: '1.21.13'
8181
- name: Verify image builds
8282
run: |
8383
docker build --tag infrawatch/sg-core:latest --file build/Dockerfile .

.github/workflows/updates.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
# (github.event.issue.author_association == 'CONTRIBUTOR') ||
1717
# (github.event.issue.author_association == 'MEMBER')
1818
# )
19-
runs-on: ubuntu-20.04
19+
runs-on: ubuntu-latest
2020
steps:
2121
- name: update PR with coveralls badge
2222
uses: actions/github-script@v7.0.1

.golangci.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
run:
2-
skip-dirs:
3-
- plugins/transport/dummy-alertmanager
4-
- plugins/transport/dummy-events
5-
- plugins/transport/dummy-metrics
6-
- plugins/transport/dummy-logs
7-
- plugins/application/print
8-
- devenv
91
issues:
102
exclude-rules:
113
- linters:
@@ -21,12 +13,26 @@ issues:
2113
- staticcheck
2214
# https://staticcheck.io/docs/checks#SA4008 (The variable in the loop condition never changes, are you incrementing the wrong variable?)
2315
text: "SA4008:"
24-
16+
# Don't warn on unused parameters.
17+
# Parameter names are useful; replacing them with '_' is undesirable.
18+
- linters: [revive]
19+
text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _'
20+
- linters: [revive]
21+
text: 'redefines-builtin-id: redefinition of the built-in function new'
22+
- linters: [revive]
23+
text: 'redefines-builtin-id: redefinition of the built-in function len'
24+
exclude-dirs:
25+
- plugins/transport/dummy-alertmanager
26+
- plugins/transport/dummy-events
27+
- plugins/transport/dummy-metrics
28+
- plugins/transport/dummy-logs
29+
- plugins/application/print
30+
- devenv
2531
linters:
2632
disable-all: true
2733
enable:
2834
- bodyclose
29-
- depguard
35+
# - depguard
3036
- dogsled
3137
- dupl
3238
- errcheck

build/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# --- build smart gateway ---
2-
FROM registry.access.redhat.com/ubi8:latest AS builder
2+
FROM registry.access.redhat.com/ubi9:latest AS builder
33
ENV GOPATH=/go
44
ENV D=/go/src/github.com/infrawatch/sg-core
55

66
WORKDIR $D
77
COPY . $D/
88

99
# dependencies for qpid-proton-c
10-
COPY build/repos/opstools.repo /etc/yum.repos.d/opstools.repo
10+
COPY build/repos/opstools.repo /etc/yum.repos.d/CentOS-OpsTools.repo
1111

1212
RUN dnf install golang git qpid-proton-c-devel -y --setopt=tsflags=nodocs
13-
RUN go install golang.org/dl/go1.20@latest && /go/bin/go1.20 download && PRODUCTION_BUILD=false CONTAINER_BUILD=true GOCMD=/go/bin/go1.20 ./build.sh
13+
RUN go install golang.org/dl/go1.21.13@latest && /go/bin/go1.21.13 download && PRODUCTION_BUILD=false CONTAINER_BUILD=true GOCMD=/go/bin/go1.21.13 ./build.sh
1414

1515
# --- end build, create smart gateway layer ---
16-
FROM registry.access.redhat.com/ubi8-minimal:latest
16+
FROM registry.access.redhat.com/ubi9-minimal:latest
1717

1818
LABEL io.k8s.display-name="Smart Gateway" \
1919
io.k8s.description="A component of the Service Telemetry Framework on the server side that ingests data from AMQP 1.x and provides a metrics scrape endpoint for Prometheus, and forwards events to ElasticSearch" \

build/repos/opstools.repo

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
# CentOS-OpsTools.repo
2-
#
3-
# Please see http://wiki.centos.org/SpecialInterestGroup/OpsTools for more
4-
# information
1+
# CentOS 9 Opstools repos
52

6-
[centos-opstools-testing]
7-
name=CentOS-OpsTools - testing repo
8-
baseurl=https://buildlogs.centos.org/centos/$releasever-stream/opstools/$basearch/collectd-5/
9-
gpgcheck=0
10-
enabled=0
11-
12-
[centos-opstools]
13-
name=CentOS-OpsTools - collectd
14-
#mirrorlist=http://mirrorlist.centos.org/?arch=$basearch&release=$releasever-stream&repo=opstools-collectd-5
15-
baseurl=http://vault.centos.org/$releasever-stream/opstools/$basearch/collectd-5/
16-
gpgcheck=0
3+
[centos9-opstools]
4+
name=centos9-opstools
5+
baseurl=http://mirror.stream.centos.org/SIGs/9-stream/opstools/$basearch/collectd-5/
176
enabled=1
18-
skip_if_unavailable=1
19-
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-OpsTools
7+
gpgcheck=0
8+
module_hotfixes=1

ci/integration/logging/run_bridge.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/bin/env bash
2-
# CI script for UBI8 job
2+
# CI script for UBI9 job
33
# purpose: spawn sg-bridge for message bus connection
44

55
set -ex
66

77
# enable required repo(s)
88
curl -o /etc/yum.repos.d/CentOS-OpsTools.repo $OPSTOOLS_REPO
9-
sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/CentOS-OpsTools.repo
109

1110
dnf install -y git gcc make qpid-proton-c-devel redhat-rpm-config
1211

1312
# install and start sg-bridge
14-
BRANCH="$(echo ${GITHUB_REF#refs/heads/})"
13+
BRANCH="$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}})"
1514
git clone https://github.com/infrawatch/sg-bridge.git
1615
pushd sg-bridge
1716
git checkout $BRANCH || true

ci/integration/logging/run_rsyslog.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/env bash
2-
# CI script for UBI8 job
2+
# CI script for UBI9 job
33
# purpose: spawn rsyslog with omamqp1 plugin and simulate log records creation
44

55
set -ex

ci/integration/logging/run_sg.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
#!/bin/env bash
2-
# CI script for UBI8 job
2+
# CI script for UBI9 job
33
# purpose: spawn sg-core to process messages sent by rsyslog
44

55
set -ex
66

77
# enable required repo(s)
88
curl -o /etc/yum.repos.d/CentOS-OpsTools.repo $OPSTOOLS_REPO
9-
sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/CentOS-OpsTools.repo
10-
# Update to use the vault mirror since Centos 8s is EOL
11-
sed -i 's/^#baseurl.*$/baseurl=http:\/\/vault.centos.org\/$releasever-stream\/opstools\/$basearch\/collectd-5/g' /etc/yum.repos.d/CentOS-OpsTools.repo
12-
sed -i 's/^mirror/#mirror/g' /etc/yum.repos.d/CentOS-OpsTools.repo
139

1410
dnf install -y git golang gcc make qpid-proton-c-devel
1511

1612
export GOBIN=$GOPATH/bin
1713
export PATH=$PATH:$GOBIN
1814

19-
go install golang.org/dl/go1.20@latest
20-
go1.20 download
15+
go install golang.org/dl/go1.21.13@latest
16+
go1.21.13 download
2117

2218
# install sg-core and start sg-core
2319
mkdir -p /usr/lib64/sg-core
24-
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.20 BUILD_ARGS=-buildvcs=false ./build.sh
20+
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.21.13 BUILD_ARGS=-buildvcs=false ./build.sh
2521

2622
./sg-core -config ./ci/integration/logging/sg_config.yaml

ci/integration/logging/run_validation.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/env bash
2-
# CI script for UBI8 job
2+
# CI script for UBI9 job
33
# purpose: verify the expected logging data is saved in supported storage types
44

55

0 commit comments

Comments
 (0)