1212 environment :
1313 required : true
1414 type : string
15- ghcr_token :
15+ secrets :
16+ AGENT_SECRET_PREFIX :
1617 required : true
17- type : string
18- sign_cert :
18+ SIGN_KEY :
1919 required : true
20- type : string
21- sign_key :
20+ SIGN_CONTAINER :
2221 required : true
23- type : string
24- sign_container :
22+ CM_AUTH :
2523 required : true
26- type : string
24+
2725
2826jobs :
2927 build_images :
4947
5048 - name : Login to GitHub Container Registry
5149 run : |
52- docker login ghcr.io -u utmstack -p ${{ inputs.ghcr_token }}
50+ docker login ghcr.io -u utmstack -p ${{ secrets.GITHUB_TOKEN }}
5351 echo "Logged in to GitHub Container Registry"
5452
5553 - name : Download base images
@@ -59,47 +57,53 @@ jobs:
5957
6058 - name : Build Agent
6159 run : |
62- cd ${{ github.workspace }}/agent/service/ config; (Get-Content const.go) | Foreach-Object { $_ -replace 'const REPLACE_KEY string = ""', 'const REPLACE_KEY string = "${{ secrets.AGENT_SECRET_PREFIX }}"' } | Set-Content const.go
60+ cd ${{ github.workspace }}/agent/config; (Get-Content const.go) | Foreach-Object { $_ -replace 'const REPLACE_KEY string = ""', 'const REPLACE_KEY string = "${{ secrets.AGENT_SECRET_PREFIX }}"' } | Set-Content const.go
6361
64- $env:GOOS = "linux"
6562 $env:GOARCH = "amd64"
66- cd ${{ github.workspace }}/agent/service; go build -o utmstack_agent_service -v .
67- cd ${{ github.workspace }}/agent/installer; go build -o utmstack_agent_installer -v .
68-
63+ $env:GOOS = "linux"
64+ cd ${{ github.workspace }}/agent
65+ go build -o utmstack_agent -v .
66+
6967 $env:GOOS = "windows"
70- cd ${{ github.workspace }}/agent/service; go build -o utmstack_agent_service.exe -v .
71- signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /f "${{ inputs.sign_cert }}" /csp "eToken Base Cryptographic Provider" /k "[{{${{ inputs.sign_key }}}}]=${{ inputs.sign_container }}" "utmstack_agent_service.exe"
72- cd ${{ github.workspace }}/agent/installer; go build -o utmstack_agent_installer.exe -v .
73- signtool sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /f "${{ inputs.sign_cert }}" /csp "eToken Base Cryptographic Provider" /k "[{{${{ inputs.sign_key }}}}]=${{ inputs.sign_container }}" "utmstack_agent_installer.exe"
68+ go build -o utmstack_agent.exe -v .
69+ 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_agent.exe"
7470
71+ New-Item -ItemType Directory -Force -Path "./dependencies/"
7572 Copy-Item -Path "C:/dependencies/${{ inputs.environment }}/agent/*" -Destination "./dependencies/"
7673
7774 echo "Agent build completed"
7875
7976 - name : Build Plugins
8077 run : |
81- export GOOS=linux
82- export GOARCH=amd64
83- cd ${{ github.workspace }}/plugins
84- make build
78+ $env:GOOS = "linux"
79+ $env:GOARCH = "amd64"
80+ cd ${{ github.workspace }}/plugins/alerts; go build -o com.utmstack.alerts.plugin -v .
81+ cd ${{ github.workspace }}/plugins/aws; go build -o com.utmstack.aws.plugin -v .
82+ cd ${{ github.workspace }}/plugins/azure; go build -o com.utmstack.azure.plugin -v .
83+ cd ${{ github.workspace }}/plugins/bitdefender; go build -o com.utmstack.bitdefender.plugin -v .
84+ cd ${{ github.workspace }}/plugins/config; go build -o com.utmstack.config.plugin -v .
85+ cd ${{ github.workspace }}/plugins/events; go build -o com.utmstack.events.plugin -v .
86+ cd ${{ github.workspace }}/plugins/gcp; go build -o com.utmstack.gcp.plugin -v .
87+ cd ${{ github.workspace }}/plugins/geolocation; go build -o com.utmstack.geolocation.plugin -v .
88+ cd ${{ github.workspace }}/plugins/inputs; go build -o com.utmstack.inputs.plugin -v .
89+ cd ${{ github.workspace }}/plugins/o365; go build -o com.utmstack.o365.plugin -v .
90+ cd ${{ github.workspace }}/plugins/sophos; go build -o com.utmstack.sophos.plugin -v .
91+ cd ${{ github.workspace }}/plugins/stats; go build -o com.utmstack.stats.plugin -v .
8592
8693 - name : Build Event Processor Image
8794 run : |
8895 New-Item -ItemType Directory -Force -Path "./geolocation/"
8996 Copy-Item -Path "C:/dependencies/${{ inputs.environment }}/geolocation/*" -Destination "./geolocation/"
90-
91- docker build -t ghcr.io/utmstack/utmstack/eventprocessor:${{ inputs.version_tag }}-community \
92- --build-arg BASE_IMAGE=ghcr.io/threatwinds/eventprocessor/base:${{ inputs.event_processor_tag }} \
93- -f ./event_processor.Dockerfile \
94- .
97+ docker build -t ghcr.io/utmstack/utmstack/eventprocessor:${{ inputs.version_tag }}-community --build-arg BASE_IMAGE=ghcr.io/threatwinds/eventprocessor/base:${{ inputs.event_processor_tag }} -f ./event_processor.Dockerfile .
9598 echo "Event Processor image built"
9699
97100 - name : Build Agent Manager Image
98101 run : |
99- go build -o ./agent-manager/agent-manager -v ./agent-manager
100- docker build -t ghcr.io/utmstack/utmstack/agent-manager:${{ inputs.version_tag }}-community \
101- -f ./agent-manager/Dockerfile \
102- .
102+ $env:GOOS = "linux"
103+ $env:GOARCH = "amd64"
104+ cd ${{ github.workspace }}/agent-manager; go build -o agent-manager -v .
105+ cd ${{ github.workspace }}
106+ docker build -t ghcr.io/utmstack/utmstack/agent-manager:${{ inputs.version_tag }}-community -f ./agent-manager/Dockerfile .
103107 echo "Agent Manager image built"
104108
105109 - name : Push images with dependencies
@@ -112,11 +116,12 @@ jobs:
112116 run : |
113117 echo "Pushing new release..."
114118 $changelog = Get-Content -Path "CHANGELOG.md" -Raw
119+ $changelog = [string]$changelog
115120
116- $cmAuth = $env: CM_AUTH | ConvertFrom-Json
121+ $cmAuth = '${{ secrets. CM_AUTH }}' | ConvertFrom-Json
117122
118123 $body = @{
119- version = ${{ inputs.version_tag }}
124+ version = ' ${{ inputs.version_tag }}'
120125 changelog = $changelog
121126 images = "ghcr.io/utmstack/utmstack/backend,ghcr.io/utmstack/utmstack/frontend,ghcr.io/utmstack/utmstack/user-auditor,ghcr.io/utmstack/utmstack/web-pdf,ghcr.io/utmstack/utmstack/eventprocessor,ghcr.io/utmstack/utmstack/agent-manager"
122127 edition = "community"
@@ -131,4 +136,4 @@ jobs:
131136 -Body $body `
132137 -ContentType "application/json"
133138
134- $response
139+ $response
0 commit comments