Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update base image to RH UBI 9 and Golang 1.22 #138

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Integration testing
env:
PROJECT_ROOT: /root/go/src/github.com/infrawatch/sg-core
OPSTOOLS_REPO: https://raw.githubusercontent.com/infrawatch/sg-core/04dcb34edd2c234b378222d2f9a17e15c0dad936/build/repos/opstools.repo
OPENSTACK_REPO: https://trunk.rdoproject.org/centos9-caracal/delorean-deps.repo

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

TEST_IMAGE: registry.access.redhat.com/ubi8
TEST_IMAGE: registry.access.redhat.com/ubi9
TEST_PORT: "-p 3000:3000"

on: [push, pull_request]
Expand All @@ -22,7 +22,7 @@ jobs:
env:
QDR_CHANNEL: collectd/metrics
BRIDGE_SOCKET: /tmp/sg-bridge/test-socket
PROMETHEUS_IMAGE: prom/prometheus:latest
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
steps:
- name: Checkout code
uses: actions/checkout@v4.1.3
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
if: steps.bridge_branch.outcome == 'success'
run: |
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \
-e GITHUB_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPENSTACK_REPO \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you notice this and why does it matter here? I would have though you can pull from either ref for building purposes.

--workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh
- name: Install collectd
Expand All @@ -86,7 +86,7 @@ jobs:
sudo collectd -C ci/integration/metrics/collectd/collectd.conf
- name: Run sg-core to process metrics
run: |
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPSTOOLS_REPO \
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/collectd/run_sg.sh
- name: Run Prometheus to store metrics
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
env:
QDR_CHANNEL: anycast/ceilometer/metering.sample
BRIDGE_SOCKET: /tmp/sg-bridge/test-socket
PROMETHEUS_IMAGE: prom/prometheus:latest
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
steps:
- name: Checkout code
uses: actions/checkout@v4.1.3
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
if: steps.bridge_branch.outcome == 'success'
run: |
docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \
-e GITHUB_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPSTOOLS_REPO \
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET -e QDR_CHANNEL -e OPENSTACK_REPO \
--workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/run_bridge.sh
- name: Set Ceilometer pipelines to QDR output and restart notification agent
Expand All @@ -186,7 +186,7 @@ jobs:
sudo systemctl restart devstack@ceilometer-anotification.service
- name: Run sg-core to process metrics
run: |
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPSTOOLS_REPO \
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/ceilometer/bridge/run_sg.sh
- name: Run Prometheus to store metrics
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
name: "[metrics] transport: socket(tcp); handler: ceilometer-metrics; application: prometheus"
runs-on: ubuntu-22.04
env:
PROMETHEUS_IMAGE: prom/prometheus:latest
PROMETHEUS_IMAGE: quay.io/prometheus/prometheus:latest
steps:
- name: Checkout code
uses: actions/checkout@v4.1.3
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
sudo systemctl restart devstack@ceilometer-anotification.service
- name: Run sg-core to process metrics
run: |
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPSTOOLS_REPO \
docker run --name=sgcore -d -uroot --network host $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/metrics/ceilometer/tcp/run_sg.sh
- name: Run Prometheus to store metrics
Expand Down Expand Up @@ -333,8 +333,8 @@ jobs:
- name: Start sg-bridge with same branch
if: steps.bridge_branch.outcome == 'success'
run: |
docker run --name=sgbridge $BRIDGE_VOLUME -d -uroot --network host -e OPSTOOLS_REPO \
-e GITHUB_REF -e BRIDGE_SOCKET --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
docker run --name=sgbridge $BRIDGE_VOLUME -d -uroot --network host -e OPENSTACK_REPO \
-e GITHUB_HEAD_REF -e BRIDGE_SOCKET --workdir=$(dirname $BRIDGE_SOCKET) --volume ${{ github.workspace }}:$PROJECT_ROOT:z \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_bridge.sh
- name: Run rsyslog to produce log messages
run: |
Expand Down Expand Up @@ -395,7 +395,7 @@ jobs:
# run integration tests
- name: Run sg-core to process log messages
run: |
docker run --name=sgcore -d -uroot --network host $TEST_PORT $BRIDGE_VOLUME -e OPSTOOLS_REPO \
docker run --name=sgcore -d -uroot --network host $TEST_PORT $BRIDGE_VOLUME -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/integration/logging/run_sg.sh
- name: sg-core debug output
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI
env:
PROJECT_ROOT: /root/go/src/github.com/infrawatch/sg-core
OPSTOOLS_REPO: https://raw.githubusercontent.com/infrawatch/sg-core/04dcb34edd2c234b378222d2f9a17e15c0dad936/build/repos/opstools.repo
OPENSTACK_REPO: https://trunk.rdoproject.org/centos9-caracal/delorean-deps.repo

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

TEST_IMAGE: registry.access.redhat.com/ubi8
TEST_IMAGE: registry.access.redhat.com/ubi9
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}

on: [push, pull_request]

jobs:
golangci:
name: Linting
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.22.6'
- uses: actions/checkout@v4.1.3
#- name: download libraries
# run: go mod download
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6.1.0
with:
# Caching conflicts happen in GHA, so just disable for now
skip-cache: true
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.51
version: v1.59.1
unit-tests:
name: Unit tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4.1.3
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
docker logs loki
- name: Run sg-core unit test suite
run: |
docker run --name=testsuite -uroot --network host -e COVERALLS_REPO_TOKEN -e OPSTOOLS_REPO \
docker run --name=testsuite -uroot --network host -e COVERALLS_REPO_TOKEN -e OPENSTACK_REPO \
--volume ${{ github.workspace }}:$PROJECT_ROOT:z --workdir $PROJECT_ROOT \
$TEST_IMAGE bash $PROJECT_ROOT/ci/unit/run_tests.sh
- name: Send coverage
Expand All @@ -72,12 +72,12 @@ jobs:
path-to-profile: ${{ github.workspace }}/profile.cov
image-build:
name: Image build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.3
- uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.22.6'
- name: Verify image builds
run: |
docker build --tag infrawatch/sg-core:latest --file build/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# (github.event.issue.author_association == 'CONTRIBUTOR') ||
# (github.event.issue.author_association == 'MEMBER')
# )
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: update PR with coveralls badge
uses: actions/github-script@v7
Expand Down
21 changes: 10 additions & 11 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
run:
skip-dirs:
- plugins/transport/dummy-alertmanager
- plugins/transport/dummy-events
- plugins/transport/dummy-metrics
- plugins/transport/dummy-logs
- plugins/application/print
- devenv
issues:
exclude-rules:
- linters:
Expand All @@ -21,12 +13,19 @@ issues:
- staticcheck
# https://staticcheck.io/docs/checks#SA4008 (The variable in the loop condition never changes, are you incrementing the wrong variable?)
text: "SA4008:"
exclude-dirs:
- plugins/transport/dummy-alertmanager
- plugins/transport/dummy-events
- plugins/transport/dummy-metrics
- plugins/transport/dummy-logs
- plugins/application/print
- devenv

linters:
disable-all: true
enable:
- bodyclose
- depguard
# - depguard
- dogsled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you look into replacements for any of these disabled linters? Sometimes there is a 1:1 replacement or a spiritual successor mentioned in the release notes.

- dupl
- errcheck
Expand All @@ -39,15 +38,15 @@ linters:
- gofmt
- goimports
- goprintffuncname
- gosec
# - gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- noctx
- nolintlint
- revive
# - revive
- staticcheck
- stylecheck
- typecheck
Expand Down
14 changes: 7 additions & 7 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# --- build smart gateway ---
FROM registry.access.redhat.com/ubi8:latest AS builder
FROM registry.access.redhat.com/ubi9:latest AS builder
ENV GOPATH=/go
ENV D=/go/src/github.com/infrawatch/sg-core
ENV SGCORE_DIR=/go/src/github.com/infrawatch/sg-core

WORKDIR $D
COPY . $D/
WORKDIR $SGCORE_DIR
COPY . $SGCORE_DIR/

# dependencies for qpid-proton-c
COPY build/repos/opstools.repo /etc/yum.repos.d/opstools.repo
COPY build/repos/centos9-caracal.repo /etc/yum.repos.d/centos9-caracal.repo

RUN dnf install golang git qpid-proton-c-devel -y --setopt=tsflags=nodocs
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
RUN go install golang.org/dl/go1.22.6@latest && /go/bin/go1.22.6 download && PRODUCTION_BUILD=false CONTAINER_BUILD=true GOCMD=/go/bin/go1.22.6 ./build.sh

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

LABEL io.k8s.display-name="Smart Gateway" \
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" \
Expand Down
18 changes: 18 additions & 0 deletions build/repos/centos9-caracal.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# CentOS 9 OpenStack repos
#
# Please see https://trunk.rdoproject.org/ and
# https://trunk.rdoproject.org/centos9-caracal/report.html for more information

[delorean-caracal-testing]
name=dlrn-caracal-testing
baseurl=https://trunk.rdoproject.org/centos9-caracal/deps/latest/
enabled=1
gpgcheck=0
module_hotfixes=1

[centos9-opstools]
name=centos9-opstools
baseurl=http://mirror.stream.centos.org/SIGs/9-stream/opstools/$basearch/collectd-5/
enabled=1
gpgcheck=0
module_hotfixes=1
19 changes: 0 additions & 19 deletions build/repos/opstools.repo

This file was deleted.

3 changes: 1 addition & 2 deletions ci/integration/logging/run_bridge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
set -ex

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

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

Expand Down
14 changes: 5 additions & 9 deletions ci/integration/logging/run_sg.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
#!/bin/env bash
# CI script for UBI8 job
# CI script for UBI9 job
# purpose: spawn sg-core to process messages sent by rsyslog

set -ex

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

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

export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

go install golang.org/dl/go1.20@latest
go1.20 download
go install golang.org/dl/go1.22.6@latest
go1.22.6 download

# install sg-core and start sg-core
mkdir -p /usr/lib64/sg-core
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.20 BUILD_ARGS=-buildvcs=false ./build.sh
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.22.6 BUILD_ARGS=-buildvcs=false ./build.sh

./sg-core -config ./ci/integration/logging/sg_config.yaml
11 changes: 5 additions & 6 deletions ci/integration/metrics/ceilometer/bridge/run_sg.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
#!/bin/env bash
# CI script for UBI8 job
# CI script for UBI9 job
# purpose: spawn sg-core to process messages sent by rsyslog

set -ex

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

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

export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

go install golang.org/dl/go1.20@latest
go1.20 download
go install golang.org/dl/go1.22.6@latest
go1.22.6 download

# install sg-core and start sg-core
mkdir -p /usr/lib64/sg-core
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.20 BUILD_ARGS=-buildvcs=false ./build.sh
PLUGIN_DIR=/usr/lib64/sg-core/ GOCMD=go1.22.6 BUILD_ARGS=-buildvcs=false ./build.sh

./sg-core -config ./ci/integration/metrics/ceilometer/bridge/sg_config.yaml
Loading
Loading