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
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]
0 commit comments