From 27759fef01697b974a1ce32e706e6c0c2f7c14ad Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 11:03:45 +0200 Subject: [PATCH 1/9] Update to Golang 1.21.13 --- .github/workflows/tests.yml | 4 ++-- build/Dockerfile | 2 +- ci/integration/logging/run_sg.sh | 6 +++--- ci/integration/metrics/ceilometer/bridge/run_sg.sh | 6 +++--- ci/integration/metrics/ceilometer/tcp/run_sg.sh | 6 +++--- ci/integration/metrics/collectd/run_sg.sh | 6 +++--- ci/unit/run_tests.sh | 6 +++--- go.mod | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a3cef223..1b23e2e1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21.13' - uses: actions/checkout@v4.1.3 #- name: download libraries # run: go mod download @@ -77,7 +77,7 @@ jobs: - uses: actions/checkout@v4.1.3 - uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.21.13' - name: Verify image builds run: | docker build --tag infrawatch/sg-core:latest --file build/Dockerfile . diff --git a/build/Dockerfile b/build/Dockerfile index c11c13b9..8f46697c 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -10,7 +10,7 @@ COPY . $D/ COPY build/repos/opstools.repo /etc/yum.repos.d/opstools.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.21.13@latest && /go/bin/go1.21.13 download && PRODUCTION_BUILD=false CONTAINER_BUILD=true GOCMD=/go/bin/go1.21.13 ./build.sh # --- end build, create smart gateway layer --- FROM registry.access.redhat.com/ubi8-minimal:latest diff --git a/ci/integration/logging/run_sg.sh b/ci/integration/logging/run_sg.sh index eb23fe19..3e425cf7 100644 --- a/ci/integration/logging/run_sg.sh +++ b/ci/integration/logging/run_sg.sh @@ -16,11 +16,11 @@ 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.21.13@latest +go1.21.13 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.21.13 BUILD_ARGS=-buildvcs=false ./build.sh ./sg-core -config ./ci/integration/logging/sg_config.yaml diff --git a/ci/integration/metrics/ceilometer/bridge/run_sg.sh b/ci/integration/metrics/ceilometer/bridge/run_sg.sh index 747d3362..afa91277 100644 --- a/ci/integration/metrics/ceilometer/bridge/run_sg.sh +++ b/ci/integration/metrics/ceilometer/bridge/run_sg.sh @@ -13,11 +13,11 @@ 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.21.13@latest +go1.21.13 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.21.13 BUILD_ARGS=-buildvcs=false ./build.sh ./sg-core -config ./ci/integration/metrics/ceilometer/bridge/sg_config.yaml diff --git a/ci/integration/metrics/ceilometer/tcp/run_sg.sh b/ci/integration/metrics/ceilometer/tcp/run_sg.sh index 1ef16839..087c8888 100644 --- a/ci/integration/metrics/ceilometer/tcp/run_sg.sh +++ b/ci/integration/metrics/ceilometer/tcp/run_sg.sh @@ -13,11 +13,11 @@ 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.21.13@latest +go1.21.13 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.21.13 BUILD_ARGS=-buildvcs=false ./build.sh ./sg-core -config ./ci/integration/metrics/ceilometer/tcp/sg_config.yaml diff --git a/ci/integration/metrics/collectd/run_sg.sh b/ci/integration/metrics/collectd/run_sg.sh index ea1cd4cc..a54c2354 100644 --- a/ci/integration/metrics/collectd/run_sg.sh +++ b/ci/integration/metrics/collectd/run_sg.sh @@ -13,11 +13,11 @@ 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.21.13@latest +go1.21.13 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.21.13 BUILD_ARGS=-buildvcs=false ./build.sh ./sg-core -config ./ci/integration/metrics/collectd/sg_config.yaml diff --git a/ci/unit/run_tests.sh b/ci/unit/run_tests.sh index 83a4c92e..f6ab60ee 100644 --- a/ci/unit/run_tests.sh +++ b/ci/unit/run_tests.sh @@ -14,8 +14,8 @@ yum install -y git golang gcc make glibc-langpack-en 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.21.13@latest +go1.21.13 download -go1.20 test -v -coverprofile=profile.cov ./... +go1.21.13 test -v -coverprofile=profile.cov ./... diff --git a/go.mod b/go.mod index d42be7bc..c55d4901 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/infrawatch/sg-core -go 1.20 +go 1.21.13 require ( collectd.org v0.5.0 From d6b4f6cf36d2604ed6120bcfbb8f156cdd1c5626 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 11:27:53 +0200 Subject: [PATCH 2/9] Update base image to UBI9 Update to use OpenStack repos instead of Opstools for fetching qpid-proton-c library --- .github/workflows/integration.yml | 18 +++++++++--------- .github/workflows/tests.yml | 6 +++--- build/Dockerfile | 6 +++--- build/repos/centos9-caracal.repo | 18 ++++++++++++++++++ build/repos/opstools.repo | 19 ------------------- ci/integration/logging/run_bridge.sh | 5 ++--- ci/integration/logging/run_rsyslog.sh | 2 +- ci/integration/logging/run_sg.sh | 8 ++------ ci/integration/logging/run_validation.sh | 2 +- .../metrics/ceilometer/bridge/run_sg.sh | 5 ++--- .../metrics/ceilometer/run_validation.sh | 2 +- .../metrics/ceilometer/tcp/run_sg.sh | 6 +++--- ci/integration/metrics/collectd/run_sg.sh | 5 ++--- .../metrics/collectd/run_validation.sh | 2 +- ci/integration/metrics/run_bridge.sh | 5 ++--- ci/unit/run_tests.sh | 7 +++---- 16 files changed, 53 insertions(+), 63 deletions(-) create mode 100644 build/repos/centos9-caracal.repo delete mode 100644 build/repos/opstools.repo diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index ad090ae3..cc939bb6 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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" @@ -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] @@ -74,7 +74,7 @@ jobs: if: steps.bridge_branch.outcome == 'success' run: | docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \ - -e GITHUB_HEAD_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: Install collectd @@ -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 @@ -170,7 +170,7 @@ jobs: if: steps.bridge_branch.outcome == 'success' run: | docker run --name=sgbridge --network host $BRIDGE_VOLUME -d -uroot \ - -e GITHUB_HEAD_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 @@ -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 @@ -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 @@ -333,7 +333,7 @@ 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 \ + 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 @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1b23e2e1..9e6133e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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" @@ -10,7 +10,7 @@ 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] @@ -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 diff --git a/build/Dockerfile b/build/Dockerfile index 8f46697c..5dc9a706 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,5 +1,5 @@ # --- 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 @@ -7,13 +7,13 @@ WORKDIR $D COPY . $D/ # 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.21.13@latest && /go/bin/go1.21.13 download && PRODUCTION_BUILD=false CONTAINER_BUILD=true GOCMD=/go/bin/go1.21.13 ./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" \ diff --git a/build/repos/centos9-caracal.repo b/build/repos/centos9-caracal.repo new file mode 100644 index 00000000..f46eff60 --- /dev/null +++ b/build/repos/centos9-caracal.repo @@ -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 diff --git a/build/repos/opstools.repo b/build/repos/opstools.repo deleted file mode 100644 index 2d95a92d..00000000 --- a/build/repos/opstools.repo +++ /dev/null @@ -1,19 +0,0 @@ -# CentOS-OpsTools.repo -# -# Please see http://wiki.centos.org/SpecialInterestGroup/OpsTools for more -# information - -[centos-opstools-testing] -name=CentOS-OpsTools - testing repo -baseurl=https://buildlogs.centos.org/centos/$releasever-stream/opstools/$basearch/collectd-5/ -gpgcheck=0 -enabled=0 - -[centos-opstools] -name=CentOS-OpsTools - collectd -#mirrorlist=http://mirrorlist.centos.org/?arch=$basearch&release=$releasever-stream&repo=opstools-collectd-5 -baseurl=http://vault.centos.org/$releasever-stream/opstools/$basearch/collectd-5/ -gpgcheck=0 -enabled=1 -skip_if_unavailable=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-OpsTools diff --git a/ci/integration/logging/run_bridge.sh b/ci/integration/logging/run_bridge.sh index fcd734f3..92915dab 100644 --- a/ci/integration/logging/run_bridge.sh +++ b/ci/integration/logging/run_bridge.sh @@ -1,12 +1,11 @@ #!/bin/env bash -# CI script for UBI8 job +# CI script for UBI9 job # purpose: spawn sg-bridge for message bus connection 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 diff --git a/ci/integration/logging/run_rsyslog.sh b/ci/integration/logging/run_rsyslog.sh index fcca70b8..f25e062d 100644 --- a/ci/integration/logging/run_rsyslog.sh +++ b/ci/integration/logging/run_rsyslog.sh @@ -1,5 +1,5 @@ #!/bin/env bash -# CI script for UBI8 job +# CI script for UBI9 job # purpose: spawn rsyslog with omamqp1 plugin and simulate log records creation set -ex diff --git a/ci/integration/logging/run_sg.sh b/ci/integration/logging/run_sg.sh index 3e425cf7..1df293d2 100644 --- a/ci/integration/logging/run_sg.sh +++ b/ci/integration/logging/run_sg.sh @@ -1,15 +1,11 @@ #!/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 diff --git a/ci/integration/logging/run_validation.sh b/ci/integration/logging/run_validation.sh index 20eb2811..43de5f48 100644 --- a/ci/integration/logging/run_validation.sh +++ b/ci/integration/logging/run_validation.sh @@ -1,5 +1,5 @@ #!/bin/env bash -# CI script for UBI8 job +# CI script for UBI9 job # purpose: verify the expected logging data is saved in supported storage types diff --git a/ci/integration/metrics/ceilometer/bridge/run_sg.sh b/ci/integration/metrics/ceilometer/bridge/run_sg.sh index afa91277..1b2c86a5 100644 --- a/ci/integration/metrics/ceilometer/bridge/run_sg.sh +++ b/ci/integration/metrics/ceilometer/bridge/run_sg.sh @@ -1,12 +1,11 @@ #!/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 diff --git a/ci/integration/metrics/ceilometer/run_validation.sh b/ci/integration/metrics/ceilometer/run_validation.sh index 0c9b5724..5bdd3295 100644 --- a/ci/integration/metrics/ceilometer/run_validation.sh +++ b/ci/integration/metrics/ceilometer/run_validation.sh @@ -1,5 +1,5 @@ #!/bin/env bash -# CI script for UBI8 job +# CI script for UBI9 job # purpose: verify the expected metric data is scraped by Prometheus set -ex diff --git a/ci/integration/metrics/ceilometer/tcp/run_sg.sh b/ci/integration/metrics/ceilometer/tcp/run_sg.sh index 087c8888..2958b5ed 100644 --- a/ci/integration/metrics/ceilometer/tcp/run_sg.sh +++ b/ci/integration/metrics/ceilometer/tcp/run_sg.sh @@ -1,12 +1,12 @@ #!/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 +sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/centos9-caracal.repo dnf install -y git golang gcc make qpid-proton-c-devel diff --git a/ci/integration/metrics/collectd/run_sg.sh b/ci/integration/metrics/collectd/run_sg.sh index a54c2354..c1b0b0ef 100644 --- a/ci/integration/metrics/collectd/run_sg.sh +++ b/ci/integration/metrics/collectd/run_sg.sh @@ -1,12 +1,11 @@ #!/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 diff --git a/ci/integration/metrics/collectd/run_validation.sh b/ci/integration/metrics/collectd/run_validation.sh index d13ccc21..7e0bbc8c 100644 --- a/ci/integration/metrics/collectd/run_validation.sh +++ b/ci/integration/metrics/collectd/run_validation.sh @@ -1,5 +1,5 @@ #!/bin/env bash -# CI script for UBI8 job +# CI script for UBI9 job # purpose: verify the expected metric data is scraped by Prometheus set -ex diff --git a/ci/integration/metrics/run_bridge.sh b/ci/integration/metrics/run_bridge.sh index e8c94efc..5aeeecb1 100644 --- a/ci/integration/metrics/run_bridge.sh +++ b/ci/integration/metrics/run_bridge.sh @@ -1,5 +1,5 @@ #!/bin/env bash -# CI script for UBI8 job +# CI script for UBI9 job # purpose: spawn sg-bridge for message bus connection set -ex @@ -7,8 +7,7 @@ set -ex CHANNEL=$QDR_CHANNEL # 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 diff --git a/ci/unit/run_tests.sh b/ci/unit/run_tests.sh index f6ab60ee..e92cfb6f 100644 --- a/ci/unit/run_tests.sh +++ b/ci/unit/run_tests.sh @@ -1,12 +1,11 @@ #!/bin/env bash -# CI script for CentOS8 job -# purpose: runt unit test suite and submit code coverage +# CI script for CentOS9 job +# purpose: run unit test suite and submit code coverage 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 # without glibc-langpack-en locale setting in CentOS8 is broken without this package yum install -y git golang gcc make glibc-langpack-en qpid-proton-c-devel From 029fa1b3cd960b704893a55c02b2113e6346231f Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 11:44:29 +0200 Subject: [PATCH 3/9] Update Prometheus image in integration workflow --- .github/workflows/integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index cc939bb6..5411a218 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 @@ -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 @@ -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 From 0b42ede4aac79006a21c9ab63c34b7d442f2ef63 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 11:48:06 +0200 Subject: [PATCH 4/9] Update base image for tests and updates workflows Update to Ubuntu 22.04 for all actions Also updates golangci-lint-action version --- .github/workflows/tests.yml | 10 +++++----- .github/workflows/updates.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9e6133e8..e0fab31c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ 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: @@ -27,15 +27,15 @@ jobs: #- 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 @@ -72,7 +72,7 @@ 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 diff --git a/.github/workflows/updates.yml b/.github/workflows/updates.yml index 7cad2c5a..406e227e 100644 --- a/.github/workflows/updates.yml +++ b/.github/workflows/updates.yml @@ -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.0.1 From edc9f6c76984154233cdb1f54b58a9099560220f Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 11:50:15 +0200 Subject: [PATCH 5/9] Update golangci.yaml configuration --- .golangci.yaml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index d53d3f01..3e132e92 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -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: @@ -21,7 +13,13 @@ 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: From 5efd895e2c3527ccf2360f2bbb4442551a6e30b7 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 12:36:41 +0200 Subject: [PATCH 6/9] Enable linters enabled by openstack-k8s-operators --- .golangci.yaml | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 3e132e92..2d3cb419 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -21,37 +21,11 @@ issues: - plugins/application/print - devenv linters: - disable-all: true enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - # - exhaustive - - exportloopref - # - gochecknoinits - - goconst - - gocritic - - gocyclo + - errorlint + - revive + - ginkgolinter - gofmt - - goimports - - goprintffuncname - - gosec - - gosimple - govet - - ineffassign - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - # - unused - - unconvert - # NOTE: not all application plugins use ability to emit internal events through - # passed bus function in it's constructor. - #- unparam - # - whitespace +run: + timeout: 5m From 4b9b6981b9580a6b2b7feac58312fe75be377db1 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 12:56:42 +0200 Subject: [PATCH 7/9] Exclude rules golangci revive lint --- .golangci.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.golangci.yaml b/.golangci.yaml index 2d3cb419..721ace74 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -13,6 +13,14 @@ issues: - staticcheck # https://staticcheck.io/docs/checks#SA4008 (The variable in the loop condition never changes, are you incrementing the wrong variable?) text: "SA4008:" + # Don't warn on unused parameters. + # Parameter names are useful; replacing them with '_' is undesirable. + - linters: [revive] + text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _' + - linters: [revive] + text: 'redefines-builtin-id: redefinition of the built-in function new' + - linters: [revive] + text: 'redefines-builtin-id: redefinition of the built-in function len' exclude-dirs: - plugins/transport/dummy-alertmanager - plugins/transport/dummy-events From 536b3dee7396380673b78261a3a45d4074d561df Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 13:03:22 +0200 Subject: [PATCH 8/9] Restore linters used by sg-core --- .golangci.yaml | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 721ace74..5e9dfd24 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -29,11 +29,37 @@ issues: - plugins/application/print - devenv linters: + disable-all: true enable: - - errorlint - - revive - - ginkgolinter + - bodyclose + - depguard + - dogsled + - dupl + - errcheck + # - exhaustive + - exportloopref + # - gochecknoinits + - goconst + - gocritic + - gocyclo - gofmt + - goimports + - goprintffuncname + - gosec + - gosimple - govet -run: - timeout: 5m + - ineffassign + - misspell + - nakedret + - noctx + - nolintlint + - revive + - staticcheck + - stylecheck + - typecheck + # - unused + - unconvert + # NOTE: not all application plugins use ability to emit internal events through + # passed bus function in it's constructor. + #- unparam + # - whitespace From b3fe99d9ead0e9668ed549a72027aeb9da3aec21 Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Mon, 14 Oct 2024 13:12:01 +0200 Subject: [PATCH 9/9] Disable depguard linter and skip gosec rule --- .golangci.yaml | 2 +- plugins/application/elasticsearch/pkg/lib/client_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 5e9dfd24..d4533893 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -32,7 +32,7 @@ linters: disable-all: true enable: - bodyclose - - depguard + # - depguard - dogsled - dupl - errcheck diff --git a/plugins/application/elasticsearch/pkg/lib/client_test.go b/plugins/application/elasticsearch/pkg/lib/client_test.go index 628a9091..d7506a8f 100644 --- a/plugins/application/elasticsearch/pkg/lib/client_test.go +++ b/plugins/application/elasticsearch/pkg/lib/client_test.go @@ -73,7 +73,7 @@ jqo9oA+Nf0x2skN5IRDaRbG1pJiQNgMWfvTfhJFIpLhLm+vEVmiPD3XoWhAnYErw 7f5lcspAI9sun4veId/ox9eGbrz9ldw46grPy/Zkflk2eFTUStME1Pt8GAXEF/pb /5f2IAPbX29zG1UGfS5YmNLLLQYZl/oFaR3ZKNAyvklectylEjmM -----END RSA PRIVATE KEY----- -` +` // #nosec G101 testCa = `-----BEGIN CERTIFICATE----- MIIGCTCCA/GgAwIBAgIUWMjYXk9MYDUih4QmKOnWOkS1Q8gwDQYJKoZIhvcNAQEL BQAwgZMxCzAJBgNVBAYTAkN6MRAwDgYDVQQIDAdCcmVjbGF2MRAwDgYDVQQHDAdN