Skip to content

Commit

Permalink
MON-151743 Centreon next 22.10 (Jira release #20162#) (#1788)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkippes authored Nov 26, 2024
2 parents c3ad6bb + 65eb46d commit 50d2c5b
Show file tree
Hide file tree
Showing 15 changed files with 175 additions and 58 deletions.
10 changes: 8 additions & 2 deletions .github/actions/package-sign/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ inputs:
registry_password:
description: Docker registry password
required: true
registry_private_username:
description: Docker private registry username
required: true
registry_private_token:
description: Docker private registry token
required: true
params:
description: "params for script"
required: false
Expand All @@ -32,8 +38,8 @@ runs:
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ inputs.registry_url }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}
username: ${{ inputs.registry_private_username }}
password: ${{ inputs.registry_private_token }}

# REMOVE ME LATER
- run: docker pull ${{ inputs.registry_url }}/${{ inputs.image_name }}:${{ inputs.image_version}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/centreon-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ jobs:
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

- name: Test ${{ matrix.image }}
uses: ./.github/actions/runner-docker
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
script: |
await exec.exec("sleep 20s");
for (let i = 0; i < 60; i++) {
for (let i = 0; i < 120; i++) {
const failure = [];
const cancelled = [];
const pending = [];
const result = await github.rest.checks.listSuitesForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "${{ github.event.pull_request.head.sha }}"
ref: "${{ github.head_ref }}"
});
result.data.check_suites.forEach(({ app: { slug }, conclusion, id}) => {
if (slug === 'github-actions') {
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ jobs:
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}

- name: Login to Proxy Registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/gorgone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
veracode_api_id: ${{ secrets.VERACODE_API_ID_GORG }}
veracode_api_key: ${{ secrets.VERACODE_API_KEY_GORG }}
veracode_srcclr_token: ${{ secrets.VERACODE_SRCCLR_TOKEN }}
docker_registry_id: ${{ secrets.DOCKER_REGISTRY_ID }}
docker_registry_passwd: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
docker_registry_id: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
docker_registry_passwd: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

package:
needs: [get-version]
Expand Down Expand Up @@ -87,8 +87,10 @@ jobs:
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
distrib: ${{ matrix.distrib }}
secrets:
registry_username: ${{ secrets.DOCKER_REGISTRY_ID }}
registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
registry_username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
registry_password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
registry_private_username: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_USERNAME }}
registry_private_token: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_TOKEN }}

deliver-sources:
runs-on: [self-hosted, common]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lua-curl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

name: package ${{ matrix.distrib }} ${{ matrix.arch }}

Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/package-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

- name: package rpm ${{ matrix.image }}
run: |
Expand All @@ -62,10 +62,12 @@ jobs:
with:
script_name: rpm-signing
image_name: rpm-signing
image_version: ubuntu
registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
registry_username: ${{ secrets.DOCKER_REGISTRY_ID }}
registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
image_version: latest
registry_url: docker.centreon.com/centreon-private
registry_username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
registry_password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
registry_private_username: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_USERNAME }}
registry_private_token: ${{ secrets.HARBOR_RPM_GPG_SIGNING_REPO_TOKEN }}

- name: Cache RPM files
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
Expand Down Expand Up @@ -106,8 +108,8 @@ jobs:
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}

- name: debmake ${{ matrix.image }}
uses: ./centreon-collect/.github/actions/runner-docker
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ on:
required: true
registry_password:
required: true
registry_private_username:
required: true
registry_private_token:
required: true

jobs:
package:
Expand Down Expand Up @@ -132,11 +136,11 @@ jobs:
needs: [package]
runs-on: ubuntu-22.04
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/rpm-signing:ubuntu
image: docker.centreon.com/centreon-private/rpm-signing:latest
options: -t
credentials:
username: ${{ secrets.registry_username }}
password: ${{ secrets.registry_password }}
username: ${{ secrets.registry_private_username }}
password: ${{ secrets.registry_private_token }}

steps:
- run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/robot-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
veracode_api_id: ${{ secrets.VERACODE_API_ID_COLL }}
veracode_api_key: ${{ secrets.VERACODE_API_KEY_COLL }}
veracode_srcclr_token: ${{ secrets.VERACODE_SRCCLR_TOKEN }}
docker_registry_id: ${{ secrets.DOCKER_REGISTRY_ID }}
docker_registry_passwd: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
docker_registry_id: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
docker_registry_passwd: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MAJOR=22.10
MINOR=11
MINOR=12
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ endif()
# Version.
set(COLLECT_MAJOR 22)
set(COLLECT_MINOR 10)
set(COLLECT_PATCH 11)
set(COLLECT_PATCH 12)
set(COLLECT_VERSION "${COLLECT_MAJOR}.${COLLECT_MINOR}.${COLLECT_PATCH}")
add_definitions(-DCENTREON_CONNECTOR_VERSION=\"${COLLECT_VERSION}\")

Expand Down
16 changes: 14 additions & 2 deletions broker/lua/inc/com/centreon/broker/lua/macro_cache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "com/centreon/broker/neb/host_group.hh"
#include "com/centreon/broker/neb/host_group_member.hh"
#include "com/centreon/broker/neb/instance.hh"
#include "com/centreon/broker/neb/internal.hh"
#include "com/centreon/broker/neb/service.hh"
#include "com/centreon/broker/neb/service_group.hh"
#include "com/centreon/broker/neb/service_group_member.hh"
Expand All @@ -46,7 +47,13 @@ class macro_cache {
std::shared_ptr<persistent_cache> _cache;
absl::flat_hash_map<uint64_t, std::shared_ptr<neb::instance>> _instances;
absl::flat_hash_map<uint64_t, std::shared_ptr<io::data>> _hosts;
absl::flat_hash_map<uint64_t, std::shared_ptr<neb::host_group>> _host_groups;
/* The host groups cache stores also a set with the pollers telling they need
* the cache. So if no more poller needs a host group, we can remove it from
* the cache. */
absl::flat_hash_map<uint64_t,
std::pair<std::shared_ptr<neb::host_group>,
absl::flat_hash_set<uint32_t>>>
_host_groups;
absl::btree_map<std::pair<uint64_t, uint64_t>,
std::shared_ptr<neb::host_group_member>>
_host_group_members;
Expand All @@ -55,7 +62,12 @@ class macro_cache {
_custom_vars;
absl::flat_hash_map<std::pair<uint64_t, uint64_t>, std::shared_ptr<io::data>>
_services;
absl::flat_hash_map<uint64_t, std::shared_ptr<neb::service_group>>
/* The service groups cache stores also a set with the pollers telling they
* need the cache. So if no more poller needs a service group, we can remove
* it from the cache. */
absl::flat_hash_map<uint64_t,
std::pair<std::shared_ptr<neb::service_group>,
absl::flat_hash_set<uint32_t>>>
_service_groups;
absl::btree_map<std::tuple<uint64_t, uint64_t, uint64_t>,
std::shared_ptr<neb::service_group_member>>
Expand Down
36 changes: 31 additions & 5 deletions broker/lua/src/broker_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "absl/strings/string_view.h"
#include "com/centreon/broker/config/applier/state.hh"

#include <openssl/md5.h>
#include <openssl/evp.h>
#include <cstdlib>
#include <cstring>
#include <iomanip>
Expand Down Expand Up @@ -775,6 +775,30 @@ static int l_broker_stat(lua_State* L) {
}
}

static void md5_message(const unsigned char* message,
size_t message_len,
unsigned char** digest,
unsigned int* digest_len) {
EVP_MD_CTX* mdctx;
if ((mdctx = EVP_MD_CTX_new()) == nullptr) {
log_v2::lua()->error("lua: fail to call MD5 (EVP_MD_CTX_new call)");
}
if (1 != EVP_DigestInit_ex(mdctx, EVP_md5(), nullptr)) {
log_v2::lua()->error("lua: fail to call MD5 (EVP_DigestInit_ex call)");
}
if (1 != EVP_DigestUpdate(mdctx, message, message_len)) {
log_v2::lua()->error("lua: fail to call MD5 (EVP_DigestUpdate call)");
}
if ((*digest = (unsigned char*)OPENSSL_malloc(EVP_MD_size(EVP_md5()))) ==
nullptr) {
log_v2::lua()->error("lua: fail to call MD5 (OPENSSL_malloc call)");
}
if (1 != EVP_DigestFinal_ex(mdctx, *digest, digest_len)) {
log_v2::lua()->error("lua: fail to call MD5 (EVP_DigestFinal_ex call)");
}
EVP_MD_CTX_free(mdctx);
}

static int l_broker_md5(lua_State* L) {
auto digit = [](unsigned char d) -> char {
if (d < 10)
Expand All @@ -785,18 +809,20 @@ static int l_broker_md5(lua_State* L) {
size_t len;
const unsigned char* str =
reinterpret_cast<const unsigned char*>(lua_tolstring(L, -1, &len));
unsigned char md5[MD5_DIGEST_LENGTH];
MD5(str, len, md5);
char result[2 * MD5_DIGEST_LENGTH + 1];
unsigned char* md5;
uint32_t md5_len;
md5_message(str, len, &md5, &md5_len);
char result[2 * md5_len + 1];
char* tmp = result;
for (int i = 0; i < MD5_DIGEST_LENGTH; i++) {
for (uint32_t i = 0; i < md5_len; i++) {
*tmp = digit(md5[i] >> 4);
++tmp;
*tmp = digit(md5[i] & 0xf);
++tmp;
}
*tmp = 0;
lua_pushstring(L, result);
OPENSSL_free(md5);
return 1;
}

Expand Down
Loading

0 comments on commit 50d2c5b

Please sign in to comment.