diff --git a/.github/workflows/on-pr.yaml b/.github/workflows/on-pr.yaml index b1d948b0..33f96908 100644 --- a/.github/workflows/on-pr.yaml +++ b/.github/workflows/on-pr.yaml @@ -14,10 +14,10 @@ jobs: name: Run unit tests env: GOPATH: /tmp/go - HOSTNAME: ${{ secrets.BUILD_HOSTNAME }} - USERNAME: ${{ secrets.BUILD_USERNAME }} - PRIVATE_KEY: ${{ secrets.BUILD_KEY }} - PASSWORD: ${{ secrets.BUILD_PASSWORD}} + BUILD_HOSTNAME: ${{ secrets.BUILD_HOSTNAME }} + BUILD_USERNAME: ${{ secrets.BUILD_USERNAME }} + BUILD_KEY: ${{ secrets.BUILD_KEY }} + BUILD_PASSWORD: ${{ secrets.BUILD_PASSWORD}} strategy: matrix: go-version: [1.16.x, 1.17.x] @@ -33,32 +33,32 @@ jobs: run: | echo ${{ env.GITHUB_REPOSITORY}} > /tmp/git_repository echo ${{ env.GITHUB_HEAD_REF}} > /tmp/git_head_ref - # echo ${{ env.PRIVATE_KEY }} | tr '\n' ''| sshpass -p ${{ env.PASSWORD }} scp -i /dev/stdin /tmp/git_repository {{ env.USERNAME }}@${{ env.HOSTNAME }}:/tmp/git_repository - # echo ${{ env.PRIVATE_KEY }} | tr '\n' ''| sshpass -p ${{ env.PASSWORD }} scp -i /dev/stdin /tmp/git_head_ref {{ env.USERNAME }}@${{ env.HOSTNAME }}:/tmp/git_head_ref - # echo ${{ env.PRIVATE_KEY }} | tr '\n' ''| sshpass -p ${{ env.PASSWORD }} scp -i /dev/stdin ./github/workflows/run_unit_test.sh {{ env.USERNAME }}@${{ env.HOSTNAME }}:/tmp/run_unit_test.sh + # echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin /tmp/git_repository {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository + # echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin /tmp/git_head_ref {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref + # echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin ./github/workflows/run_unit_test.sh {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh - name: SCP some files uses: appleboy/scp-action@master with: - host: ${{ env.HOSTNAME }} - username: ${{ env.USERNAME }} - # passphrase: $ {{ env.PASSWORD }} - key: ${{ env.PRIVATE_KEY }} + host: ${{ env.BUILD_HOSTNAME }} + BUILD_USERNAME: ${{ env.BUILD_USERNAME }} + # passphrase: $ {{ env.BUILD_PASSWORD }} + key: ${{ env.BUILD_KEY }} port: 22 source: "/tmp/git_repository,/tmp/git_head_ref,./github/workflows/run_unit_test.sh" target: "/tmp/" - name: Trigger Unit Test - run: echo ${{ env.PRIVATE_KEY }} | sshpass -p ${{ env.PASSWORD }} ssh {{ env.USERNAME }}@{{ env.HOSTNAME }} -i /dev/stdin /tmp/run_unit_test.sh + run: echo ${{ env.BUILD_KEY }} | sshpass -p ${{ env.BUILD_PASSWORD }} ssh {{ env.BUILD_USERNAME }}@{{ env.BUILD_HOSTNAME }} -i /dev/stdin /tmp/run_unit_test.sh - name: Get the logs and cat them run: | - echo ${{ env.PRIVATE_KEY }} | sshpass -p ${{ env.PASSWORD }} scp -i /dev/stdin {{ env.USERNAME }}@${{ env.HOSTNAME }}:/tmp/test.log . + echo ${{ env.BUILD_KEY }} | sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/test.log . cat ./test.log - name: Check Error Code run: | - echo ${{ env.PRIVATE_KEY }} | sshpass -p ${{ env.PASSWORD }} scp -i /dev/stdin {{ env.USERNAME }}@${{ env.HOSTNAME }}:/tmp/return_test.txt . + echo ${{ env.BUILD_KEY }} | sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/return_test.txt . [ $(cat ./return_test.txt) -eq 0 ] integrationtest: