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 <appleboy.tw@gmail.com>
This commit is contained in:
appleboy 2024-06-05 21:18:46 +08:00
parent 9c32aa61f8
commit 97f8d752b5
No known key found for this signature in database

View file

@ -366,7 +366,7 @@ jobs:
--hostname=openssh-server \ --hostname=openssh-server \
-p 2222:2222 \ -p 2222:2222 \
-e PUBLIC_KEY="${{ env.PUBLIC_KEY }}" \ -e PUBLIC_KEY="${{ env.PUBLIC_KEY }}" \
-e SUDO_ACCESS=false \ -e SUDO_ACCESS=true \
-e PASSWORD_ACCESS=true \ -e PASSWORD_ACCESS=true \
-e USER_PASSWORD=password \ -e USER_PASSWORD=password \
-e USER_NAME=linuxserver.io \ -e USER_NAME=linuxserver.io \
@ -459,3 +459,17 @@ jobs:
echo "I am $INPUT_AAA, thanks" echo "I am $INPUT_AAA, thanks"
echo "$GITHUB_BASE_REF" echo "$GITHUB_BASE_REF"
echo "$GITHUB_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