From 348044cf4bd4a4066db7bd04e571058b24d2e931 Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 26 Sep 2024 16:14:27 +0800 Subject: [PATCH 01/14] Update README.md [Fix bugs in code examples] There is a syntax error in the code example for authHandler --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d0e6f7fc..3de51e9f 100644 --- a/README.md +++ b/README.md @@ -889,7 +889,7 @@ You can find more examples in the `examples` directory of this repository. ```js { - type: 'password' + type: 'password', username: 'foo', password: 'bar', } @@ -897,7 +897,7 @@ You can find more examples in the `examples` directory of this repository. ```js { - type: 'publickey' + type: 'publickey', username: 'foo', // Can be a string, Buffer, or parsed key containing a private key key: ..., @@ -908,7 +908,7 @@ You can find more examples in the `examples` directory of this repository. ```js { - type: 'hostbased' + type: 'hostbased', username: 'foo', localHostname: 'baz', localUsername: 'quux', @@ -921,7 +921,7 @@ You can find more examples in the `examples` directory of this repository. ```js { - type: 'agent' + type: 'agent', username: 'foo', // Can be a string that is interpreted exactly like the `agent` // connection config option or can be a custom agent @@ -932,7 +932,7 @@ You can find more examples in the `examples` directory of this repository. ```js { - type: 'keyboard-interactive' + type: 'keyboard-interactive', username: 'foo', // This works exactly the same way as a 'keyboard-interactive' // Client event handler From 14d73cb1cd242cc757cf340e3227046575aa008c Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 15:09:34 +0800 Subject: [PATCH 02/14] Create dockerci.yml --- .github/workflows/dockerci.yml | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/dockerci.yml diff --git a/.github/workflows/dockerci.yml b/.github/workflows/dockerci.yml new file mode 100644 index 00000000..4815e09d --- /dev/null +++ b/.github/workflows/dockerci.yml @@ -0,0 +1,41 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + + - name: Install & Build + run: | + npm ci + npm run build + + - name: Lint & Test + run: | + npm run lint + npm test -- --coverage + + - name: Upload coverage + uses: actions/upload-artifact@v3 + with: + name: coverage-report + path: coverage/ From 8187942dbeea1fe6e4eb5092f12246c5eb946ddf Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 15:48:07 +0800 Subject: [PATCH 03/14] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae5ae286..2e7d5309 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ env: jobs: tests-linux: - runs-on: ubuntu-latest + runs-on: self-hosted strategy: fail-fast: false matrix: From f9a857615b90bf1386061cd2c1247657f73c2552 Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 15:49:17 +0800 Subject: [PATCH 04/14] Delete .github/workflows/dockerci.yml --- .github/workflows/dockerci.yml | 41 ---------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 .github/workflows/dockerci.yml diff --git a/.github/workflows/dockerci.yml b/.github/workflows/dockerci.yml deleted file mode 100644 index 4815e09d..00000000 --- a/.github/workflows/dockerci.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: CI - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - test-build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '16' - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} - - - name: Install & Build - run: | - npm ci - npm run build - - - name: Lint & Test - run: | - npm run lint - npm test -- --coverage - - - name: Upload coverage - uses: actions/upload-artifact@v3 - with: - name: coverage-report - path: coverage/ From cdf80131dac0bfdad148ff9aa489da87d2d4ab9a Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:20:00 +0800 Subject: [PATCH 05/14] Delete .github/workflows/lint.yml --- .github/workflows/lint.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index c21c0ad7..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: lint - -on: - pull_request: - push: - branches: [ master ] - -env: - NODE_VERSION: 18.x - -jobs: - lint-js: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Check Node.js version - run: node -pe process.versions - - name: Install ESLint + ESLint configs/plugins - run: npm install --only=dev - - name: Lint files - run: npm run lint From 3a23c65d73b3c81836da4052f3700c98bebb0f6c Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:21:35 +0800 Subject: [PATCH 06/14] Update ci.yml --- .github/workflows/ci.yml | 59 ++++++++++++---------------------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e7d5309..885eca2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,23 @@ env: CI_CHECK_FAIL: ssh2 jobs: + build: + runs-on: self-hosted + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build Docker Image + run: docker build -t myapp:${{ github.sha }} . + + - name: Push Docker Image + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin + docker push myapp:${{ github.sha }} tests-linux: runs-on: self-hosted strategy: @@ -34,48 +51,6 @@ jobs: run: npm install - name: Run tests run: npm test - tests-macos: - runs-on: macos-latest - strategy: - fail-fast: false - matrix: - node-version: [16.x, 18.x, 20.x, 22.x] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Install Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Check Node.js version - run: node -pe process.versions - - name: Install module - run: npm install - - name: Run tests - run: npm test - tests-macos-homebrew: - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Use Node.js (latest) - run: brew install node - - name: Install Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Check Node.js version - run: node -pe process.versions - - name: Install module - run: npm install - - name: Run tests - run: npm test tests-windows: runs-on: windows-2019 strategy: From 3821423cb1c4d6c2008c13830cbf094bd0603939 Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:22:25 +0800 Subject: [PATCH 07/14] Create Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..21ce4dad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM alpine +CMD echo "Hello, World!" From ec40cb12a354042e8be0408a28ed752bf66cdcc2 Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:24:24 +0800 Subject: [PATCH 08/14] Update ci.yml --- .github/workflows/ci.yml | 45 ---------------------------------------- 1 file changed, 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 885eca2b..caf0e2ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,48 +26,3 @@ jobs: run: | echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin docker push myapp:${{ github.sha }} - tests-linux: - runs-on: self-hosted - strategy: - fail-fast: false - matrix: - node-version: [10.16.0, 10.x, 12.x, 14.x, 16.x, 18.x, 20.x, 22.x] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Check Node.js version - run: node -pe process.versions - - name: Install Python 2.7 - if: ${{ matrix.node-version == '10.16.0' }} - run: | - sudo apt install python2.7 - echo "PYTHON=$(which python2.7)" >> "$GITHUB_ENV" - - name: Install module - run: npm install - - name: Run tests - run: npm test - tests-windows: - runs-on: windows-2019 - strategy: - fail-fast: false - matrix: - node-version: [16.x, 18.x, 20.x, 22.x] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Check Node.js version - run: node -pe process.versions - - name: Install module - run: npm install - - name: Run tests - run: npm test From 7a9f828789c50d07c92b77e8f5b488fbcbe9ce56 Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:59:56 +0800 Subject: [PATCH 09/14] Update ci.yml --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index caf0e2ca..41f89a79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,6 @@ jobs: - name: Check out code uses: actions/checkout@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Build Docker Image run: docker build -t myapp:${{ github.sha }} . From e0d19c1acf9fc14423d3c8c97e8265b630c0340e Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 17:01:02 +0800 Subject: [PATCH 10/14] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41f89a79..9baf882e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,5 +21,5 @@ jobs: - name: Push Docker Image run: | - echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin + echo ${{ secrets.DOCKER_PASSWORD }} | docker login tcss-agent.tencentcloudcr.com --username ${{ secrets.DOCKER_USERNAME }} --password-stdin docker push myapp:${{ github.sha }} From c0d75ad5af6c463770108e56f0d6a86b083eff18 Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 17:07:22 +0800 Subject: [PATCH 11/14] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9baf882e..ed9630eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,4 +22,5 @@ jobs: - name: Push Docker Image run: | echo ${{ secrets.DOCKER_PASSWORD }} | docker login tcss-agent.tencentcloudcr.com --username ${{ secrets.DOCKER_USERNAME }} --password-stdin - docker push myapp:${{ github.sha }} + docker tag myapp:${{ github.sha }} tcss-agent.tencentcloudcr.com/tcss/zunlong:${{ github.sha }} + docker push tcss-agent.tencentcloudcr.com/tcss/zunlong:${{ github.sha }} From 9accbc8bc1b6a99410804f2cf38e35f46fbaa1bc Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Thu, 3 Jul 2025 17:16:51 +0800 Subject: [PATCH 12/14] Update ci.yml --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed9630eb..014e74f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,6 @@ jobs: runs-on: self-hosted steps: - - name: Check out code - uses: actions/checkout@v2 - name: Build Docker Image run: docker build -t myapp:${{ github.sha }} . From eece753b789550a7fb897f7ff6a92da7ee88c8bc Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Fri, 8 Aug 2025 10:03:03 +0800 Subject: [PATCH 13/14] Update ci.yml --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 014e74f6..0d6f2ed8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,3 +22,8 @@ jobs: echo ${{ secrets.DOCKER_PASSWORD }} | docker login tcss-agent.tencentcloudcr.com --username ${{ secrets.DOCKER_USERNAME }} --password-stdin docker tag myapp:${{ github.sha }} tcss-agent.tencentcloudcr.com/tcss/zunlong:${{ github.sha }} docker push tcss-agent.tencentcloudcr.com/tcss/zunlong:${{ github.sha }} + - name: Scan image by cicd-scanner + run: > + docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --network=host + ccr.ccs.tencentyun.com/cwp/cicdscanner:latest + --token=${{ secrets.CICD_TOKEN }} --imageId=${{ env.REPO_TAG }} From 2baeda896fa43bf39dc08e78c1ed22db371b027c Mon Sep 17 00:00:00 2001 From: zunlongzhou <42513377+zunlongzhou@users.noreply.github.com> Date: Fri, 8 Aug 2025 16:21:31 +0800 Subject: [PATCH 14/14] Update ci.yml --- .github/workflows/ci.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d6f2ed8..e8192ea9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,16 @@ jobs: echo ${{ secrets.DOCKER_PASSWORD }} | docker login tcss-agent.tencentcloudcr.com --username ${{ secrets.DOCKER_USERNAME }} --password-stdin docker tag myapp:${{ github.sha }} tcss-agent.tencentcloudcr.com/tcss/zunlong:${{ github.sha }} docker push tcss-agent.tencentcloudcr.com/tcss/zunlong:${{ github.sha }} - - name: Scan image by cicd-scanner - run: > - docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --network=host - ccr.ccs.tencentyun.com/cwp/cicdscanner:latest - --token=${{ secrets.CICD_TOKEN }} --imageId=${{ env.REPO_TAG }} + - name: Create issue if risk found + uses: actions/github-script@v7 + with: + script: | + const result = "123123123123123123"; + if (result && result.trim() !== "") { + github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: "CI/CD扫描发现风险", + body: result + }); + }