Skip to content

Commit 56a7d1a

Browse files
committed
avoid sign agents in dev environments
1 parent 6c734d3 commit 56a7d1a

File tree

2 files changed

+90
-115
lines changed

2 files changed

+90
-115
lines changed

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

Lines changed: 44 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v10') }}; then
2121
echo "DEV environment"
2222
echo "tag=v10-dev" >> $GITHUB_OUTPUT
23-
elif ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'v10' && startsWith(github.event.pull_request.head.ref, 'release/v10') }}; then
24-
echo "QA environment"
25-
echo "tag=v10-qa" >> $GITHUB_OUTPUT
2623
elif ${{ github.event_name == 'push' && github.ref == 'refs/heads/v10' }}; then
2724
echo "RC environment"
2825
echo "tag=v10-rc" >> $GITHUB_OUTPUT
@@ -65,7 +62,7 @@ jobs:
6562
name: Build Agent-Manager Image & Agent & Dependencies
6663
needs: [validations,setup_deployment]
6764
if: ${{ needs.setup_deployment.outputs.tag != '' }}
68-
runs-on: ubuntu-24.04
65+
runs-on: ubuntu-22.04
6966
steps:
7067
- name: Check out code into the right branch
7168
uses: actions/checkout@v4
@@ -88,51 +85,55 @@ jobs:
8885
GOOS=windows GOARCH=amd64 go build -o utmstack_agent_service.exe -v .
8986
GOOS=windows GOARCH=arm64 go build -o utmstack_agent_service_arm64.exe -v .
9087
91-
echo "Signing Windows Agent..."
92-
FILES_TO_SIGN=("utmstack_agent_service.exe" "utmstack_agent_service_arm64.exe")
93-
for file in "${FILES_TO_SIGN[@]}"; do
94-
echo "Uploading $file for signing..."
95-
RESPONSE=$(curl -sS -f -X POST http://customermanager.utmstack.com:8081/api/v1/upload \
96-
-H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
97-
-F "file=@$file")
98-
99-
FILE_ID=$(echo "$RESPONSE" | jq -r '.file_id')
100-
101-
if [[ -z "$FILE_ID" || "$FILE_ID" == "null" ]]; then
102-
echo "❌ Failed to upload $file for signing."
103-
exit 1
104-
fi
105-
106-
echo "Uploaded $file with file_id: $FILE_ID"
107-
echo "Waiting for signing to complete..."
88+
if [[ {{ needs.setup_deployment.outputs.tag }} != "v10-dev" ]]; then
89+
echo "Signing Windows Agent..."
90+
FILES_TO_SIGN=("utmstack_agent_service.exe" "utmstack_agent_service_arm64.exe")
91+
for file in "${FILES_TO_SIGN[@]}"; do
92+
echo "Uploading $file for signing..."
93+
RESPONSE=$(curl -sS -f -X POST http://customermanager.utmstack.com:8081/api/v1/upload \
94+
-H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
95+
-F "file=@$file")
10896
109-
while true; do
110-
STATUS=$(curl -sS -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
111-
http://customermanager.utmstack.com:8081/api/v1/status/$FILE_ID | jq -r '.status')
97+
FILE_ID=$(echo "$RESPONSE" | jq -r '.file_id')
11298
113-
if [[ "$STATUS" == "ready" ]]; then
114-
echo "✅ $file has been signed."
115-
break
116-
elif [[ "$STATUS" == "signing" ]]; then
117-
echo "⏳ Still signing $file... waiting 5s"
118-
sleep 5
119-
else
120-
echo "❌ Unexpected status: $STATUS"
99+
if [[ -z "$FILE_ID" || "$FILE_ID" == "null" ]]; then
100+
echo "❌ Failed to upload $file for signing."
121101
exit 1
122102
fi
123-
done
124-
125-
echo "Downloading signed $file..."
126-
curl -sS -f -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
127-
-o "$file" \
128-
http://customermanager.utmstack.com:8081/api/v1/download/$FILE_ID
129103
130-
echo "Marking $file as finished..."
131-
curl -sS -X POST -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
132-
http://customermanager.utmstack.com:8081/api/v1/finish/$FILE_ID > /dev/null || true
133-
done
104+
echo "Uploaded $file with file_id: $FILE_ID"
105+
echo "Waiting for signing to complete..."
106+
107+
while true; do
108+
STATUS=$(curl -sS -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
109+
http://customermanager.utmstack.com:8081/api/v1/status/$FILE_ID | jq -r '.status')
110+
111+
if [[ "$STATUS" == "ready" ]]; then
112+
echo "✅ $file has been signed."
113+
break
114+
elif [[ "$STATUS" == "signing" ]]; then
115+
echo "⏳ Still signing $file... waiting 5s"
116+
sleep 5
117+
else
118+
echo "❌ Unexpected status: $STATUS"
119+
exit 1
120+
fi
121+
done
122+
123+
echo "Downloading signed $file..."
124+
curl -sS -f -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
125+
-o "$file" \
126+
http://customermanager.utmstack.com:8081/api/v1/download/$FILE_ID
127+
128+
echo "Marking $file as finished..."
129+
curl -sS -X POST -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
130+
http://customermanager.utmstack.com:8081/api/v1/finish/$FILE_ID > /dev/null || true
131+
done
134132
135-
echo "✅ All agents signed successfully."
133+
echo "✅ All agents signed successfully."
134+
else
135+
echo "Skipping signing for Alpha environment."
136+
fi
136137
137138
- name: Prepare dependencies for Agent Manager Image
138139
run: |
@@ -210,36 +211,6 @@ jobs:
210211
run: |
211212
sudo ./installer
212213
213-
deploy_qa:
214-
name: Deploy to v10-qa environment
215-
needs: [build_agent, runner_release, setup_deployment]
216-
if: ${{ needs.setup_deployment.outputs.tag == 'v10-qa' }}
217-
runs-on: utmstack-v10-qa
218-
steps:
219-
- name: Check out code into the right branch
220-
uses: actions/checkout@v4
221-
222-
- name: Set up Go 1.x
223-
uses: actions/setup-go@v5
224-
with:
225-
go-version: ^1.20
226-
id: go
227-
228-
- name: Build
229-
working-directory: ./installer
230-
env:
231-
GOOS: linux
232-
GOARCH: amd64
233-
run: |
234-
go build -o installer -v .
235-
mv installer /home/utmstack/installer
236-
chmod +x /home/utmstack/installer
237-
238-
- name: Run
239-
working-directory: /home/utmstack
240-
run: |
241-
sudo ./installer
242-
243214
deploy_rc:
244215
name: Deploy to v10-rc environment
245216
needs: [build_agent, runner_release, setup_deployment]

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

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
name: Build & Push Images with dependencies
3939
needs:
4040
- build_images
41-
runs-on: ubuntu-24.04
41+
runs-on: ubuntu-22.04
4242
steps:
4343
- name: Check out code into the right branch
4444
uses: actions/checkout@v4
@@ -68,51 +68,55 @@ jobs:
6868
GOOS=windows GOARCH=amd64 go build -o utmstack_agent_service.exe -v .
6969
GOOS=windows GOARCH=arm64 go build -o utmstack_agent_service_arm64.exe -v .
7070
71-
echo "Signing Windows Agent..."
72-
FILES_TO_SIGN=("utmstack_agent_service.exe" "utmstack_agent_service_arm64.exe")
73-
for file in "${FILES_TO_SIGN[@]}"; do
74-
echo "Uploading $file for signing..."
75-
RESPONSE=$(curl -sS -f -X POST http://customermanager.utmstack.com:8081/api/v1/upload \
76-
-H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
77-
-F "file=@$file")
78-
79-
FILE_ID=$(echo "$RESPONSE" | jq -r '.file_id')
80-
81-
if [[ -z "$FILE_ID" || "$FILE_ID" == "null" ]]; then
82-
echo "❌ Failed to upload $file for signing."
83-
exit 1
84-
fi
85-
86-
echo "Uploaded $file with file_id: $FILE_ID"
87-
echo "Waiting for signing to complete..."
88-
89-
while true; do
90-
STATUS=$(curl -sS -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
91-
http://customermanager.utmstack.com:8081/api/v1/status/$FILE_ID | jq -r '.status')
92-
93-
if [[ "$STATUS" == "ready" ]]; then
94-
echo "✅ $file has been signed."
95-
break
96-
elif [[ "$STATUS" == "signing" ]]; then
97-
echo "⏳ Still signing $file... waiting 5s"
98-
sleep 5
99-
else
100-
echo "❌ Unexpected status: $STATUS"
71+
if [[ {{ inputs.environment }} != "alpha" ]]; then
72+
echo "Signing Windows Agent..."
73+
FILES_TO_SIGN=("utmstack_agent_service.exe" "utmstack_agent_service_arm64.exe")
74+
for file in "${FILES_TO_SIGN[@]}"; do
75+
echo "Uploading $file for signing..."
76+
RESPONSE=$(curl -sS -f -X POST http://customermanager.utmstack.com:8081/api/v1/upload \
77+
-H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
78+
-F "file=@$file")
79+
80+
FILE_ID=$(echo "$RESPONSE" | jq -r '.file_id')
81+
82+
if [[ -z "$FILE_ID" || "$FILE_ID" == "null" ]]; then
83+
echo "❌ Failed to upload $file for signing."
10184
exit 1
10285
fi
103-
done
10486
105-
echo "Downloading signed $file..."
106-
curl -sS -f -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
107-
-o "$file" \
108-
http://customermanager.utmstack.com:8081/api/v1/download/$FILE_ID
109-
110-
echo "Marking $file as finished..."
111-
curl -sS -X POST -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
112-
http://customermanager.utmstack.com:8081/api/v1/finish/$FILE_ID > /dev/null || true
113-
done
87+
echo "Uploaded $file with file_id: $FILE_ID"
88+
echo "Waiting for signing to complete..."
89+
90+
while true; do
91+
STATUS=$(curl -sS -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
92+
http://customermanager.utmstack.com:8081/api/v1/status/$FILE_ID | jq -r '.status')
93+
94+
if [[ "$STATUS" == "ready" ]]; then
95+
echo "✅ $file has been signed."
96+
break
97+
elif [[ "$STATUS" == "signing" ]]; then
98+
echo "⏳ Still signing $file... waiting 5s"
99+
sleep 5
100+
else
101+
echo "❌ Unexpected status: $STATUS"
102+
exit 1
103+
fi
104+
done
105+
106+
echo "Downloading signed $file..."
107+
curl -sS -f -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
108+
-o "$file" \
109+
http://customermanager.utmstack.com:8081/api/v1/download/$FILE_ID
110+
111+
echo "Marking $file as finished..."
112+
curl -sS -X POST -H "Authorization: Bearer ${{ secrets.SIGNER_TOKEN }}" \
113+
http://customermanager.utmstack.com:8081/api/v1/finish/$FILE_ID > /dev/null || true
114+
done
114115
115-
echo "✅ All agents signed successfully."
116+
echo "✅ All agents signed successfully."
117+
else
118+
echo "Skipping signing for Alpha environment."
119+
fi
116120
117121
- name: Build Plugins
118122
env:

0 commit comments

Comments
 (0)