Skip to content

Centreon Monitoring Agent Windows build and packaging #388

Centreon Monitoring Agent Windows build and packaging

Centreon Monitoring Agent Windows build and packaging #388

Workflow file for this run

name: Centreon Monitoring Agent Windows build and packaging
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- agent/**
- custom-triplets/**
- CMakeLists.txt
- CMakeListsWindows.txt
- vcpkg.json
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
- master
- "[2-9][0-9].[0-9][0-9].x"
paths:
- agent/**
- custom-triplets/**
- CMakeLists.txt
- CMakeListsWindows.txt
- vcpkg.json
jobs:
get-version:
uses: ./.github/workflows/get-version.yml
with:
version_file: CMakeLists.txt
build-and-test-agent:
needs: [get-version]
runs-on: windows-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.COLLECT_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.COLLECT_S3_SECRET_KEY }}
steps:
- uses: jfrog/setup-jfrog-cli@26da2259ee7690e63b5410d7451b2938d08ce1f9 # v4.0.0
env:
JF_URL: https://centreon.jfrog.io
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
# in order to have the same checksum between windows-agent and windows-agent-robot-test
- name: nocrlf conversion
run: git config --system core.autocrlf false
- name: Checkout sources
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Compile Agent
run: .github/scripts/windows-agent-compile.ps1
shell: powershell
# - name: Common test
# run: |
# cd build_windows
# tests/ut_common
# - name: Agent test
# run: |
# cd build_windows
# tests/ut_agent
- name: deliver
if: |
contains(fromJson('["unstable", "testing"]'), needs.get-version.outputs.stability) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
run: |
Write-Host "[DEBUG] deliver to testing - Major version: ${{ needs.get-version.outputs.major_version }}"
Write-Host "[DEBUG] deliver to testing - Minor version: ${{ needs.get-version.outputs.minor_version }}"
$VERSION = "${{ needs.get-version.outputs.version }}"
$MODULE_NAME = "monitoring-agent-$VERSION"
$STABILITY = "${{ needs.get-version.outputs.stability }}"
$TARGET_PATH = "installers/monitoring-agent/${{ needs.get-version.outputs.major_version }}/$STABILITY/$MODULE_NAME/"
$VERSION_EXE = "centreon-monitoring-agent-${VERSION}.exe"
Copy-Item -Path "agent\installer\centreon-monitoring-agent.exe" -Destination "${VERSION_EXE}"
Write-Host "[DEBUG] deliver testing to - Target path: ${TARGET_PATH}"
jf rt upload $VERSION_EXE "${TARGET_PATH}" --sync-deletes="${TARGET_PATH}"
- name: promote testing to stable
# if: |
# contains(fromJson('["stable", "testing"]'), needs.get-version.outputs.stability) && github.event_name != 'workflow_dispatch' && ! cancelled()
run: |
Set-PSDebug -Trace 2
Write-Host "[DEBUG] promote to stable - Major version: ${{ needs.get-version.outputs.major_version }}"
Write-Host "[DEBUG] promote to stable - Minor version: ${{ needs.get-version.outputs.minor_version }}"
$VERSION= "${{ needs.get-version.outputs.version }}"
$MODULE_NAME= "monitoring-agent-${{ needs.get-version.outputs.version }}"
$STABILITY= "${{ needs.get-version.outputs.stability }}"
$SRC_PATH = "installers/monitoring-agent/${{ needs.get-version.outputs.major_version }}/canary/$MODULE_NAME/"
# $SRC_PATH = "installers/monitoring-agent/${{ needs.get-version.outputs.major_version }}/testing/$MODULE_NAME/"
$TARGET_PATH = "installers/monitoring-agent/${{ needs.get-version.outputs.major_version }}/stable/$MODULE_NAME/"
# $TARGET_PATH = "installers/monitoring-agent/${{ needs.get-version.outputs.major_version }}/$STABILITY/$MODULE_NAME/"
$VERSION_EXE = "centreon-monitoring-agent-${VERSION}.exe"
Write-Host "[DEBUG] promote to stable from: ${SRC_PATH}/${VERSION_EXE}"
jf rt download "${SRC_PATH}/${VERSION_EXE}"
Write-Host "[DEBUG] promote to stable ${VERSION_EXE} to path: ${TARGET_PATH}"
jf rt upload $VERSION_EXE "${TARGET_PATH}" --sync-deletes="${TARGET_PATH}"
shell: powershell