Skip to content

Commit 1a79864

Browse files
committed
update v11 beta actions
1 parent 8a92d20 commit 1a79864

9 files changed

+72
-37
lines changed

.github/workflows/v10-principal-multi-env.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,11 @@ jobs:
8181

8282
- name: Build and Sign Agent
8383
run: |
84-
cd ${{ github.workspace }}/agent/config
85-
sed -i 's|const REPLACE_KEY string = ""|const REPLACE_KEY string = "${{ secrets.AGENT_SECRET_PREFIX }}"|' const.go
86-
8784
echo "Building Agent..."
8885
cd ${{ github.workspace }}/agent
89-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o utmstack_agent_service -v .
90-
GOOS=windows GOARCH=amd64 go build -o utmstack_agent_service.exe -v .
91-
GOOS=windows GOARCH=arm64 go build -o utmstack_agent_service_arm64.exe -v .
86+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o utmstack_agent_service -v -ldflags "-X 'github.com/utmstack/UTMStack/agent/config.REPLACE_KEY=${{ secrets.AGENT_SECRET_PREFIX }}'" .
87+
GOOS=windows GOARCH=amd64 go build -o utmstack_agent_service.exe -v -ldflags "-X 'github.com/utmstack/UTMStack/agent/config.REPLACE_KEY=${{ secrets.AGENT_SECRET_PREFIX }}'" .
88+
GOOS=windows GOARCH=arm64 go build -o utmstack_agent_service_arm64.exe -v -ldflags "-X 'github.com/utmstack/UTMStack/agent/config.REPLACE_KEY=${{ secrets.AGENT_SECRET_PREFIX }}'" .
9289
9390
if [[ ${{ needs.setup_deployment.outputs.tag }} != "v10-dev" ]]; then
9491
echo "Signing Windows Agent..."
@@ -137,7 +134,7 @@ jobs:
137134
138135
echo "✅ All agents signed successfully."
139136
else
140-
echo "Skipping signing for Alpha environment."
137+
echo "Skipping signing for Dev environment."
141138
fi
142139
143140
- name: Prepare dependencies for Agent Manager Image

.github/workflows/v11-principal-beta-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ jobs:
5757
secrets:
5858
AGENT_SECRET_PREFIX: ${{ secrets.AGENT_SECRET_PREFIX }}
5959
SIGNER_TOKEN: ${{ secrets.SIGNER_TOKEN }}
60-
CM_AUTH: ${{ secrets.CM_AUTH_ALPHA }}
60+
CM_AUTH: ${{ secrets.CM_AUTH_BETA }}
6161

.github/workflows/v11-principal-installer-release.yml

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,47 @@ on:
88
required: true
99

1010
jobs:
11+
setup_deployment:
12+
name: Setup Deployment
13+
runs-on: ubuntu-24.04
14+
outputs:
15+
environment: ${{ steps.set-env.outputs.environment }}
16+
version: ${{ steps.set-env.outputs.version }}
17+
steps:
18+
- name: Validate and Determine Build Environment
19+
id: set-env
20+
run: |
21+
VERSION="${{ github.event.inputs.version_tag }}"
22+
23+
# Validate version format and determine environment
24+
if [[ "$VERSION" =~ ^v11\.[0-9]+\.[0-9]+$ ]]; then
25+
echo "Production environment detected"
26+
echo "environment=prod" >> $GITHUB_OUTPUT
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
29+
elif [[ "$VERSION" =~ ^v11\.[0-9]+\.[0-9]+-beta\.[0-9]+$ ]]; then
30+
echo "Beta environment detected"
31+
echo "environment=beta" >> $GITHUB_OUTPUT
32+
echo "version=$VERSION" >> $GITHUB_OUTPUT
33+
34+
elif [[ "$VERSION" =~ ^v11\.[0-9]+\.[0-9]+-rc\.[0-9]+$ ]]; then
35+
echo "RC environment detected"
36+
echo "environment=rc" >> $GITHUB_OUTPUT
37+
echo "version=$VERSION" >> $GITHUB_OUTPUT
38+
39+
else
40+
echo "ERROR: Invalid version format. Version must match one of:"
41+
echo " - v11.x.x (production)"
42+
echo " - v11.x.x-beta.x (beta)"
43+
echo " - v11.x.x-rc.x (release candidate)"
44+
exit 1
45+
fi
46+
1147
build:
1248
name: Build
1349
runs-on: ubuntu-24.04
50+
needs: setup_deployment
51+
if: ${{ needs.setup_deployment.outputs.environment != '' }}
1452
steps:
1553
- name: Check out code into the right branch
1654
uses: actions/checkout@v4
@@ -22,25 +60,28 @@ jobs:
2260
id: go
2361

2462
- name: Build
63+
working-directory: ./installer
2564
env:
2665
GOOS: linux
2766
GOARCH: amd64
2867
run: |
29-
cd "${{ github.workspace }}/installer/config"
30-
sed -i 's|const INSTALLER_VERSION = ""|const INSTALLER_VERSION = "${{ secrets.AGENT_SECRET_PREFIX }}"|' const.go
31-
cd "${{ github.workspace }}/installer"
32-
go build -o installer -v .
68+
echo "Building Installer..."
69+
go build -o installer -v -ldflags "\
70+
-X 'github.com/utmstack/UTMStack/installer/config.DEFAULT_BRANCH=${{ needs.setup_deployment.outputs.environment }}' \
71+
-X 'github.com/utmstack/UTMStack/installer/config.INSTALLER_VERSION=${{ needs.setup_deployment.outputs.version }}' \
72+
-X 'github.com/utmstack/UTMStack/installer/config.REPLACE=${{ secrets.CM_ENCRYPT_SALT }}' \
73+
-X 'github.com/utmstack/UTMStack/installer/config.PUBLIC_KEY=${{ secrets.CM_SIGN_PUBLIC_KEY }}'" .
3374
3475
- name: Create Release
3576
id: create_release
3677
uses: softprops/action-gh-release@v2
3778
env:
3879
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3980
with:
40-
tag_name: ${{ github.event.inputs.version_tag }}
41-
name: ${{ github.event.inputs.version_tag }}
81+
tag_name: ${{ needs.setup_deployment.outputs.version }}
82+
name: ${{ needs.setup_deployment.outputs.version }}
4283
body_path: ./CHANGELOG.md
4384
draft: false
44-
prerelease: false
85+
prerelease: ${{ needs.setup_deployment.outputs.environment != 'prod' }}
4586
files: |
4687
./installer/installer

.github/workflows/v11-principal-production-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ jobs:
5757
secrets:
5858
AGENT_SECRET_PREFIX: ${{ secrets.AGENT_SECRET_PREFIX }}
5959
SIGNER_TOKEN: ${{ secrets.SIGNER_TOKEN }}
60-
CM_AUTH: ${{ secrets.CM_AUTH_ALPHA }}
60+
CM_AUTH: ${{ secrets.CM_AUTH_PROD }}
6161

.github/workflows/v11-principal-rc-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ jobs:
5757
secrets:
5858
AGENT_SECRET_PREFIX: ${{ secrets.AGENT_SECRET_PREFIX }}
5959
SIGNER_TOKEN: ${{ secrets.SIGNER_TOKEN }}
60-
CM_AUTH: ${{ secrets.CM_AUTH_ALPHA }}
60+
CM_AUTH: ${{ secrets.CM_AUTH_RC }}
6161

.github/workflows/v11-used-build.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,12 @@ jobs:
5757
5858
- name: Build and Sign Agent
5959
run: |
60-
cd ${{ github.workspace }}/agent/config
61-
sed -i 's|const REPLACE_KEY string = ""|const REPLACE_KEY string = "${{ secrets.AGENT_SECRET_PREFIX }}"|' const.go
62-
6360
echo "Building Agent..."
6461
cd ${{ github.workspace }}/agent
6562
66-
GOOS=linux GOARCH=amd64 go build -o utmstack_agent_service -v .
67-
# GOOS=linux GOARCH=arm64 go build -o utmstack_agent_service_arm64 -v .
68-
GOOS=windows GOARCH=amd64 go build -o utmstack_agent_service.exe -v .
69-
GOOS=windows GOARCH=arm64 go build -o utmstack_agent_service_arm64.exe -v .
63+
GOOS=linux GOARCH=amd64 go build -o utmstack_agent_service -v -ldflags "-X 'github.com/utmstack/UTMStack/agent/config.REPLACE_KEY=${{ secrets.AGENT_SECRET_PREFIX }}'" .
64+
GOOS=windows GOARCH=amd64 go build -o utmstack_agent_service.exe -v -ldflags "-X 'github.com/utmstack/UTMStack/agent/config.REPLACE_KEY=${{ secrets.AGENT_SECRET_PREFIX }}'" .
65+
GOOS=windows GOARCH=arm64 go build -o utmstack_agent_service_arm64.exe -v -ldflags "-X 'github.com/utmstack/UTMStack/agent/config.REPLACE_KEY=${{ secrets.AGENT_SECRET_PREFIX }}'" .
7066
7167
if [[ {{ inputs.environment }} != "alpha" ]]; then
7268
echo "Signing Windows Agent..."

.github/workflows/v11-used-docker-golang.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,19 @@ on:
66
image_name:
77
required: true
88
type: string
9-
environment:
9+
tag:
1010
required: true
1111
type: string
12+
flags:
13+
required: false
14+
type: string
1215
jobs:
1316
build:
1417
name: Build
1518
runs-on: ubuntu-24.04
1619
steps:
1720
- name: Check out code into the right branch
1821
uses: actions/checkout@v4
19-
20-
- name: Load Version
21-
id: set-version
22-
run: |
23-
versions=$(cat "${{ github.workspace }}/versions.json")
24-
service_version=$(echo "${versions}" | jq -r --arg s "${{inputs.image_name}}" '.[$s]')
25-
echo "version=${service_version}" >> "$GITHUB_OUTPUT"
2622

2723
- name: Set up Go 1.x
2824
uses: actions/setup-go@v5
@@ -36,7 +32,12 @@ jobs:
3632

3733
- name: Build Binary
3834
working-directory: ./${{inputs.image_name}}
39-
run: go build -o ${{inputs.image_name}} -v .
35+
run: |
36+
if [ -n "${{inputs.flags}}" ]; then
37+
go build -o ${{inputs.image_name}} -v -ldflags "${{inputs.flags}}" .
38+
else
39+
go build -o ${{inputs.image_name}} -v .
40+
fi
4041
4142
- name: Login to GitHub Container Registry
4243
uses: docker/login-action@v3
@@ -50,4 +51,4 @@ jobs:
5051
with:
5152
context: ./${{inputs.image_name}}
5253
push: true
53-
tags: ghcr.io/utmstack/utmstack/${{inputs.image_name}}:v${{ steps.set-version.outputs.version }}-${{inputs.environment}}
54+
tags: ghcr.io/utmstack/utmstack/${{inputs.image_name}}:${{inputs.tag}}

.github/workflows/v11-used-images-without-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: ./.github/workflows/v11-used-docker-golang.yml
5252
with:
5353
image_name: ${{ inputs.microservice }}
54-
environment: ${{inputs.tag}}-community
54+
tag: ${{inputs.tag}}-community
5555

5656
java_11_deployment:
5757
name: Java 11 deployment

agent/config/const.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
"github.com/utmstack/UTMStack/agent/utils"
77
)
88

9-
const REPLACE_KEY string = ""
10-
119
type DataType string
1210

1311
type ProtoPort struct {
@@ -16,6 +14,8 @@ type ProtoPort struct {
1614
}
1715

1816
var (
17+
REPLACE_KEY string
18+
1919
DependUrl = "https://%s:%s/private/dependencies/agent/%s"
2020
AgentManagerPort = "9000"
2121
LogAuthProxyPort = "50051"

0 commit comments

Comments
 (0)