From e493f69029b4b2cffd6c8d59e02272d17da71467 Mon Sep 17 00:00:00 2001 From: JooYoung Park Date: Tue, 5 Mar 2024 15:11:15 +0800 Subject: [PATCH] fix gh runner setup and integration test Signed-off-by: JooYoung Park --- .github/workflows/integration_tests.yml | 7 ++++++- scripts/github_runner/conf.json | 20 +++++++++++-------- scripts/github_runner/deploy_runners.go | 10 +++++++++- .../github_runner/setup_bare_metal_runner.sh | 8 +++++--- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index d2d38c7c2..8440b1ca8 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -47,6 +47,11 @@ jobs: sudo apt update sudo apt install git -y + - name: Add rsync + run: | + sudo apt update + sudo apt install rsync -y + - name: Check out code into the Go module directory uses: actions/checkout@v4 with: @@ -68,7 +73,7 @@ jobs: if: ${{ always() }} uses: actions/upload-artifact@v4 with: - name: ctrd-logs + name: ctrd-logs-${{ matrix.test-name }} path: | /tmp/ctrd-logs/ ${{ github.workspace }}/*.log diff --git a/scripts/github_runner/conf.json b/scripts/github_runner/conf.json index 64159a385..d577cfc45 100644 --- a/scripts/github_runner/conf.json +++ b/scripts/github_runner/conf.json @@ -1,20 +1,24 @@ { "ghOrg": "", + "ghBranch": "", "ghPat": "", - "hostUsername": "ubuntu", + "hostUsername": "root", "runners": { - "pc91.cloudlab.umass.edu": { + "10.96.190.31": { "type": "cri", "sandbox": "firecracker" }, - "pc101.cloudlab.umass.edu": { + "10.96.190.176": { "type": "cri", - "sandbox": "gvisor", - "restart": true + "sandbox": "gvisor" }, - "pc72.cloudlab.umass.edu": { + "10.96.190.94": { "type": "integ", - "num": 2 + "num": 2, + "restart": false + }, + "10.96.190.53": { + "type": "profile" } } -} +} \ No newline at end of file diff --git a/scripts/github_runner/deploy_runners.go b/scripts/github_runner/deploy_runners.go index 8bec00e1e..63be7bc24 100644 --- a/scripts/github_runner/deploy_runners.go +++ b/scripts/github_runner/deploy_runners.go @@ -42,6 +42,7 @@ type RunnerConf struct { type DeployerConf struct { GhOrg string `json:"ghOrg"` + GhBranch string `json:"ghBranch"` GhPat string `json:"ghPat"` HostUsername string `json:"hostUsername"` RunnerConfs map[string]RunnerConf `json:"runners"` @@ -121,8 +122,15 @@ func deployRunner(host string, runnerConf RunnerConf, deployerConf *DeployerConf log.Fatalf("Failed to connect to %s@%s: %s", deployerConf.HostUsername, host, err) } + log.Debug("Remove unattended-upgrades") + out, err := client.Exec("sudo systemctl stop unattended-upgrades && sudo apt remove -y unattended-upgrades") + log.Debug(string(out)) + if err != nil { + log.Fatalf("Cannot disable unattended-upgrades") + } + log.Debugf("Cloning vHive repository on %s@%s", deployerConf.HostUsername, host) - out, err := client.Exec(fmt.Sprintf("rm -rf ./vhive ./actions-runner && git clone --depth=1 https://github.com/%s/vhive", deployerConf.GhOrg)) + out, err = client.Exec(fmt.Sprintf("rm -rf ./vhive ./actions-runner && git clone --depth=1 --branch=%s https://github.com/%s/vhive", deployerConf.GhBranch, deployerConf.GhOrg)) log.Debug(string(out)) if err != nil { log.Fatalf("Failed to clone vHive repository on %s@%s: %s", deployerConf.HostUsername, host, err) diff --git a/scripts/github_runner/setup_bare_metal_runner.sh b/scripts/github_runner/setup_bare_metal_runner.sh index 77ff288b0..f4d09cc73 100755 --- a/scripts/github_runner/setup_bare_metal_runner.sh +++ b/scripts/github_runner/setup_bare_metal_runner.sh @@ -45,9 +45,12 @@ else echo "No service file, no need to clean" fi - VHIVE_ROOT="$(git rev-parse --show-toplevel)" -"$VHIVE_ROOT"/scripts/cloudlab/setup_node.sh "$SANDBOX" +SCRIPTS=$VHIVE_ROOT/scripts + +source $SCRIPTS/install_go.sh +pushd $SCRIPTS && go build -o setup_tool && popd +$SCRIPTS/setup_tool setup_node "$SANDBOX" cd export RUNNER_ALLOW_RUNASROOT=1 @@ -58,4 +61,3 @@ RUNNER_LABEL=$SANDBOX-cri curl -s https://raw.githubusercontent.com/actions/runner/main/scripts/create-latest-svc.sh | bash -s - -s "$GH_ORG"/vhive -n "$RUNNER_NAME" -l "$RUNNER_LABEL" -f echo "0 4 * * * root reboot" | sudo tee -a /etc/crontab -