Skip to content

Update dependencies in agent and collector #10

Update dependencies in agent and collector

Update dependencies in agent and collector #10

name: Collector Installer Build
on:
release:
types: [ 'released' ]
push:
branches: [ 'main', 'feature/**' ]
paths:
- 'collector-installer/**'
- 'version.yml'
pull_request_review:
types: [submitted]
paths:
- 'collector-installer/**'
- 'version.yml'
jobs:
check:
name: Checking
runs-on: ubuntu-latest
outputs:
env_version: ${{ steps.set-env.outputs.env_version }}
steps:
- name: Determine Build Environment
id: set-env
run: |
if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/feature/') }}; then
echo "DEV environment"
echo "env_version=v10-dev" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'pull_request_review' && github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'main' && startsWith(github.event.pull_request.head.ref, 'feature/') }}; then
echo "QA environment"
echo "env_version=v10-qa" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}; then
echo "RC environment"
echo "env_version=v10-rc" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'release' }}; then
echo "RELEASE environment"
echo "env_version=release" >> $GITHUB_OUTPUT
fi
build:
name: Build
needs: check
if: needs.check.outputs.env_version != ''
runs-on: signing
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Build and sign collector installer
id: set-env
run: |
$env:DEPLOY_ENV = '${{ needs.check.outputs.env_version }}'
$env:GOOS = "linux"
$env:GOARCH = "amd64"
cd ${{ github.workspace }}/collector-installer; go build -o utmstack_collector_installer -v .
$env:GOOS = "windows"
cd ${{ github.workspace }}/collector-installer; go build -o utmstack_collector_installer.exe -v .
signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /f "${{ vars.SIGN_CERT }}" /csp "eToken Base Cryptographic Provider" /k "[{{${{ secrets.SIGN_KEY }}}}]=${{ secrets.SIGN_CONTAINER }}" "utmstack_collector_installer.exe"
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.12.1/python-3.12.1-amd64.exe" -OutFile "python-installer.exe"
Start-Process -FilePath "python-installer.exe" -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait
Remove-Item -Path "python-installer.exe"
python -m pip install --upgrade pip
pip install requests google-cloud-storage pyyaml
$env:GCP_KEY = '${{ secrets.GCP_KEY }}'
cd ${{ github.workspace }}/.github/scripts; & 'C:\Program Files\Python312\python.exe' 'services-deploy.py' $env:DEPLOY_ENV 'collector-installer'
cd ${{ github.workspace }}; Remove-Item -Path "./*" -Recurse -Force