From 97f8d752b568999364c7296fa08e33d68367e3fd Mon Sep 17 00:00:00 2001 From: appleboy Date: Wed, 5 Jun 2024 21:18:46 +0800 Subject: [PATCH] ci: enable root access in CI pipeline - Change `SUDO_ACCESS` environment variable from `false` to `true` - Add a step to switch to root user using `appleboy/ssh-action@v1.0.3` with specified parameters and commands Signed-off-by: appleboy --- .github/workflows/ssh-server.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ssh-server.yml b/.github/workflows/ssh-server.yml index 0dbe24a..4aec5ac 100644 --- a/.github/workflows/ssh-server.yml +++ b/.github/workflows/ssh-server.yml @@ -366,7 +366,7 @@ jobs: --hostname=openssh-server \ -p 2222:2222 \ -e PUBLIC_KEY="${{ env.PUBLIC_KEY }}" \ - -e SUDO_ACCESS=false \ + -e SUDO_ACCESS=true \ -e PASSWORD_ACCESS=true \ -e USER_PASSWORD=password \ -e USER_NAME=linuxserver.io \ @@ -459,3 +459,17 @@ jobs: echo "I am $INPUT_AAA, thanks" echo "$GITHUB_BASE_REF" echo "$GITHUB_REF" + + - name: switch to root user + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ env.REMOTE_HOST }} + username: linuxserver.io + key: ${{ env.PRIVATE_KEY }} + port: 2222 + script_stop: true + request_pty: true + command_timeout: 30s + script: | + whoami && echo 'hello world' && touch todo.txt + sudo whoami