mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-19 11:44:20 -04:00
AB#2392 Store serial logs in actions (#39)
Co-authored-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
parent
50acded80b
commit
020cf51fc6
4 changed files with 72 additions and 0 deletions
28
.github/actions/constellation_create/action.yml
vendored
28
.github/actions/constellation_create/action.yml
vendored
|
@ -159,3 +159,31 @@ runs:
|
||||||
if [ ${{ inputs.autoscale }} = true ]; then autoscale=--autoscale; fi
|
if [ ${{ inputs.autoscale }} = true ]; then autoscale=--autoscale; fi
|
||||||
constellation init ${autoscale}
|
constellation init ${autoscale}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Download boot logs
|
||||||
|
run: |
|
||||||
|
echo "::group::Download boot logs"
|
||||||
|
case $CSP in
|
||||||
|
azure)
|
||||||
|
AZURE_RESOURCE_GROUP=$(yq eval ".provider.azure.resourceGroup" constellation-conf.yaml)
|
||||||
|
./.github/actions/constellation_create/az-logs.sh ${AZURE_RESOURCE_GROUP}
|
||||||
|
;;
|
||||||
|
gcp)
|
||||||
|
CONTROL_NODES=$(jq -r '.gcpcontrolplaneinstancegroup' constellation-state.json)
|
||||||
|
WORKER_NODES=$(jq -r '.gcpworkerinstancegroup' constellation-state.json)
|
||||||
|
ZONE=$(jq -r '.gcpzone' constellation-state.json)
|
||||||
|
./.github/actions/constellation_create/gcp-logs.sh ${CONTROL_NODES} ${WORKER_NODES} ${ZONE}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "::endgroup::"
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
CSP: ${{ inputs.cloudProvider }}
|
||||||
|
continue-on-error: true
|
||||||
|
if: ${{ always() }}
|
||||||
|
- name: Upload boot logs
|
||||||
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
|
||||||
|
with:
|
||||||
|
name: serial-logs
|
||||||
|
path: '*.log'
|
||||||
|
if: ${{ always() && !env.ACT }}
|
||||||
|
|
21
.github/actions/constellation_create/az-logs.sh
vendored
Executable file
21
.github/actions/constellation_create/az-logs.sh
vendored
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
printf "Fetching logs of instances in resource group %s\n" $1
|
||||||
|
|
||||||
|
# get list of all scale sets
|
||||||
|
scalesetsjson=$(az vmss list --resource-group $1 -o json)
|
||||||
|
scalesetslist=$(echo $scalesetsjson | jq -r '.[] | .name')
|
||||||
|
subscription=$(az account show | jq -r .id)
|
||||||
|
|
||||||
|
printf "Checking scalesets %s\n" $scalesetslist
|
||||||
|
|
||||||
|
for scaleset in $scalesetslist; do
|
||||||
|
instanceids=$(az vmss list-instances --resource-group $1 --name ${scaleset} -o json | jq -r '.[] | .instanceId')
|
||||||
|
printf "Checking instance IDs %s\n" $instanceids
|
||||||
|
for instanceid in $instanceids; do
|
||||||
|
bloburi=$(az rest --method post --url https://management.azure.com/subscriptions/${subscription}/resourceGroups/${1}/providers/Microsoft.Compute/virtualMachineScaleSets/${scaleset}/virtualmachines/$instanceid/retrieveBootDiagnosticsData?api-version=2022-03-01 | jq '.serialConsoleLogBlobUri' -r)
|
||||||
|
sleep 4
|
||||||
|
curl -sL -o "./${scaleset}-${instanceid}.log" $bloburi
|
||||||
|
echo $(realpath "./${scaleset}-${instanceid}.log")
|
||||||
|
done
|
||||||
|
done
|
18
.github/actions/constellation_create/gcp-logs.sh
vendored
Executable file
18
.github/actions/constellation_create/gcp-logs.sh
vendored
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Usage: ./gcp-logs.sh <control-instance-group-name> <worker-instance-group-name> <zone>
|
||||||
|
|
||||||
|
CONTROL_INSTANCES=$(gcloud compute instance-groups list-instances $1 --zone $3 --format=json | jq -r .'[] | .instance')
|
||||||
|
WORKER_INSTANCES=$(gcloud compute instance-groups list-instances $2 --zone $3 --format=json | jq -r .'[] | .instance')
|
||||||
|
ALL_INSTANCES="$CONTROL_INSTANCES $WORKER_INSTANCES"
|
||||||
|
|
||||||
|
printf "Fetching logs for %s and %s\n" $CONTROL_INSTANCES $WORKER_INSTANCES
|
||||||
|
|
||||||
|
for INSTANCE in $ALL_INSTANCES; do
|
||||||
|
SHORT_NAME=${INSTANCE##*/}
|
||||||
|
printf "Fetching for %s\n" $SHORT_NAME
|
||||||
|
gcloud compute instances get-serial-port-output $INSTANCE \
|
||||||
|
--port 1 \
|
||||||
|
--start 0 \
|
||||||
|
--zone $3 > $SHORT_NAME.log
|
||||||
|
done
|
|
@ -67,6 +67,11 @@ func runInitialize(cmd *cobra.Command, args []string) error {
|
||||||
return dialer.New(nil, validator.V(cmd), &net.Dialer{})
|
return dialer.New(nil, validator.V(cmd), &net.Dialer{})
|
||||||
}
|
}
|
||||||
helmLoader := &helm.ChartLoader{}
|
helmLoader := &helm.ChartLoader{}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(cmd.Context(), time.Hour)
|
||||||
|
defer cancel()
|
||||||
|
cmd.SetContext(ctx)
|
||||||
|
|
||||||
return initialize(cmd, newDialer, fileHandler, helmLoader, license.NewClient())
|
return initialize(cmd, newDialer, fileHandler, helmLoader, license.NewClient())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue