Skip to content

Commit e13c387

Browse files
authored
ci(action): display an environment variable with special characters (#351)
- Add a new job `testing07` with steps to set environment variables and create an SSH server container - Set a special character password in environment variables - Run a Docker container for an OpenSSH server and capture its IP address - Add steps to SSH into the server using username and password authentication Signed-off-by: appleboy <[email protected]>
1 parent 1c1ad10 commit e13c387

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,3 +504,48 @@ jobs:
504504
command_timeout: 30s
505505
script: |
506506
whoami
507+
508+
testing07:
509+
name: some special character
510+
runs-on: ubuntu-latest
511+
steps:
512+
- name: checkout
513+
uses: actions/checkout@v4
514+
515+
- name: Set Environment Variables
516+
run: |
517+
PASS='3HUS$?8kLu)}'
518+
printf "PASS=${PASS}" >> $GITHUB_ENV
519+
520+
- name: create new ssh server
521+
run: |
522+
docker run -d \
523+
--name=openssh-server \
524+
--hostname=openssh-server \
525+
-p 2222:2222 \
526+
-e SUDO_ACCESS=false \
527+
-e PASSWORD_ACCESS=true \
528+
-e USER_PASSWORD='${{ env.PASS }}' \
529+
-e USER_NAME=linuxserver.io \
530+
--restart unless-stopped \
531+
lscr.io/linuxserver/openssh-server:latest
532+
docker exec openssh-server sh -c "hostname -i" > ip.txt
533+
echo "REMOTE_HOST<<EOF" >> $GITHUB_ENV
534+
cat ip.txt >> $GITHUB_ENV
535+
echo "EOF" >> $GITHUB_ENV
536+
echo "======= container ip address ========="
537+
cat ip.txt
538+
echo "======================================"
539+
sleep 2
540+
541+
- name: ssh by username and password
542+
uses: ./
543+
with:
544+
host: ${{ env.REMOTE_HOST }}
545+
username: linuxserver.io
546+
password: ${{ env.PASS }}
547+
port: 2222
548+
script: |
549+
#!/usr/bin/env bash
550+
set -e
551+
whoami

0 commit comments

Comments
 (0)