From ead6c2d07e522c8c39837aa25c4fb12bfe333477 Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Fri, 20 Aug 2021 12:59:46 -0300 Subject: [PATCH 1/7] Move to Github Registry Containers --- .../{package_test.yml => PullRequest.yml} | 38 ++++++++++++++-- .../workflows/codeql and ossar analysis.yml | 44 ------------------- .github/workflows/main.yml | 34 ++++++++++---- .../{tag_version.yml => relelases.yml} | 14 +++--- bin/Docker.js | 8 ++++ 5 files changed, 73 insertions(+), 65 deletions(-) rename .github/workflows/{package_test.yml => PullRequest.yml} (51%) delete mode 100644 .github/workflows/codeql and ossar analysis.yml rename .github/workflows/{tag_version.yml => relelases.yml} (85%) diff --git a/.github/workflows/package_test.yml b/.github/workflows/PullRequest.yml similarity index 51% rename from .github/workflows/package_test.yml rename to .github/workflows/PullRequest.yml index f0c049e..8bce855 100644 --- a/.github/workflows/package_test.yml +++ b/.github/workflows/PullRequest.yml @@ -1,7 +1,25 @@ -name: Test - The Bds Maneger Core -on: [pull_request] +name: Docker And Node Test +on: + pull_request: + branches: + - main jobs: + CodeQL: + name: Analyze + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: "javascript" + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 + Test: runs-on: ubuntu-latest strategy: @@ -26,8 +44,16 @@ jobs: - name: Run test run: npm run ci - Test_Docker: + Docker-Multiarch: runs-on: ubuntu-latest + strategy: + matrix: + arch: + - amd64 + - arm64 + - arm/v7 + + name: "Build And Test Docker Image, Arch: ${{ matrix.arch }}" steps: - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -39,8 +65,12 @@ jobs: uses: actions/checkout@master - name: Build Docker Image + id: DockerArch uses: docker/build-push-action@v2 with: target: bdscore tags: coretest:latest - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: linux/${{ matrix.arch }} + + - name: "Run Docker Image, digiest: ${{ outputs.DockerArch.digest }}" + run: docker run --rm -it -e DebugArch="true" coretest:latest@{{ outputs.DockerArch.digest }} diff --git a/.github/workflows/codeql and ossar analysis.yml b/.github/workflows/codeql and ossar analysis.yml deleted file mode 100644 index a830bca..0000000 --- a/.github/workflows/codeql and ossar analysis.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: "CodeQL and OSSAR" -on: - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: "38 17 * * */3" - - cron: '36 21 * * 2' - -jobs: - OSSAR-Scan: - runs-on: windows-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Run OSSAR - uses: github/ossar-action@v1 - id: ossar - - name: Upload OSSAR results - uses: github/codeql-action/upload-sarif@v1 - with: - sarif_file: ${{ steps.ossar.outputs.sarifFile }} - - analyze: - name: Analyze - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - language: [ "javascript" ] - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8fc847d..6b72541 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,6 +8,21 @@ env: DOCKER_ARCH: linux/amd64,linux/arm64,linux/arm/v7 jobs: + CodeQL: + name: Analyze + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: "javascript" + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 + npm: runs-on: ubuntu-latest steps: @@ -21,7 +36,7 @@ jobs: - name: Edit Version env: - RunID: ${{ github.run_id }} + RunID: ${{ github.run_id }} run: node .github/ChangeVersion.js - name: Install Packages @@ -45,8 +60,10 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: checkout uses: actions/checkout@master @@ -57,7 +74,7 @@ jobs: with: push: true target: bdscore - tags: bdsmaneger/core:main + tags: ghcr.io/the-bds-maneger/core:main platforms: ${{ env.DOCKER_ARCH }} docker_base: @@ -73,8 +90,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: checkout uses: actions/checkout@master @@ -85,7 +103,5 @@ jobs: with: push: true target: bdsbase - tags: | - bdsmaneger/base:main - bdsmaneger/node_image:main + tags: ghcr.io/the-bds-maneger/base:main platforms: ${{ env.DOCKER_ARCH }} diff --git a/.github/workflows/tag_version.yml b/.github/workflows/relelases.yml similarity index 85% rename from .github/workflows/tag_version.yml rename to .github/workflows/relelases.yml index 7dea2e7..965a175 100644 --- a/.github/workflows/tag_version.yml +++ b/.github/workflows/relelases.yml @@ -1,4 +1,4 @@ -name: Npm Packages Stable and Docker Image +name: Publish Releases on: release: types: @@ -44,8 +44,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: checkout uses: actions/checkout@master @@ -56,7 +57,7 @@ jobs: with: push: true target: bdscore - tags: bdsmaneger/core:latest + tags: ghcr.io/the-bds-maneger/core:latest platforms: ${{ env.DOCKER_ARCH }} docker_base: @@ -85,8 +86,5 @@ jobs: push: true target: bdsbase tags: | - bdsmaneger/base:latest - bdsmaneger/base:${{ github.run_id }} - bdsmaneger/node_image:latest - bdsmaneger/node_image:${{ github.run_id }} + ghcr.io/the-bds-maneger/base:latest platforms: ${{ env.DOCKER_ARCH }} diff --git a/bin/Docker.js b/bin/Docker.js index 2044f1e..1dc1cf5 100644 --- a/bin/Docker.js +++ b/bin/Docker.js @@ -54,6 +54,14 @@ function StartServer(){ } }); } + // Debug Arch + if (process.env.DebugArch === "true") { + console.log("Debug Arch:", process.arch); + setTimeout(() => { + console.log("Stop Server end debug"); + process.exit(0); + }, 1000); + } } // Check Installed Server -- 2.50.0 From de07be5141438709a180f9a4d987d2244d464663 Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Fri, 20 Aug 2021 13:05:08 -0300 Subject: [PATCH 2/7] Pull --- .github/workflows/PullRequest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml index 8bce855..1c8b257 100644 --- a/.github/workflows/PullRequest.yml +++ b/.github/workflows/PullRequest.yml @@ -72,5 +72,5 @@ jobs: tags: coretest:latest platforms: linux/${{ matrix.arch }} - - name: "Run Docker Image, digiest: ${{ outputs.DockerArch.digest }}" - run: docker run --rm -it -e DebugArch="true" coretest:latest@{{ outputs.DockerArch.digest }} + - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" + run: docker run --rm -it -e DebugArch="true" coretest:latest@${{ steps.DockerArch.outputs.digest }} -- 2.50.0 From eae7ca1c95aa72b86b439e2cf4fdd7f84bcc269d Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Fri, 20 Aug 2021 13:15:25 -0300 Subject: [PATCH 3/7] Pull --- .github/workflows/PullRequest.yml | 17 ++++++++++++----- .github/workflows/main.yml | 6 ++++-- .github/workflows/relelases.yml | 8 ++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml index 1c8b257..aafa1f5 100644 --- a/.github/workflows/PullRequest.yml +++ b/.github/workflows/PullRequest.yml @@ -11,20 +11,27 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: languages: "javascript" + - name: Autobuild uses: github/codeql-action/autobuild@v1 + - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 - Test: + Node: runs-on: ubuntu-latest strategy: matrix: - node-version: [14.x, 15.x, 16.x] + node-version: + - 14.x + - 15.x + - 16.x + steps: - uses: actions/checkout@v2 @@ -35,14 +42,14 @@ jobs: - name: Edit Version env: - RunID: ${{ github.run_id }} + RunID: ${{ github.run_id }} run: node .github/ChangeVersion.js - name: Install node depedencies run: npm install -d --no-save - name: Run test - run: npm run ci + run: npm test Docker-Multiarch: runs-on: ubuntu-latest @@ -73,4 +80,4 @@ jobs: platforms: linux/${{ matrix.arch }} - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" - run: docker run --rm -it -e DebugArch="true" coretest:latest@${{ steps.DockerArch.outputs.digest }} + run: docker run --rm -i -e DebugArch="true" coretest:latest@${{ steps.DockerArch.outputs.digest }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6b72541..6cd97fe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,12 +14,15 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: languages: "javascript" + - name: Autobuild uses: github/codeql-action/autobuild@v1 + - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 @@ -45,7 +48,7 @@ jobs: - name: NPM Publish run: npm publish --tag dev env: - NODE_AUTH_TOKEN: "${{ secrets.NPM_ORG_TOKEN }}" + NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}' docker_core: needs: [npm] @@ -64,7 +67,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: checkout uses: actions/checkout@master diff --git a/.github/workflows/relelases.yml b/.github/workflows/relelases.yml index 965a175..223a691 100644 --- a/.github/workflows/relelases.yml +++ b/.github/workflows/relelases.yml @@ -73,8 +73,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: checkout uses: actions/checkout@master @@ -85,6 +86,5 @@ jobs: with: push: true target: bdsbase - tags: | - ghcr.io/the-bds-maneger/base:latest + tags: ghcr.io/the-bds-maneger/base:latest platforms: ${{ env.DOCKER_ARCH }} -- 2.50.0 From 7d801783f0e1af0d9fb3764d06444800d1519f25 Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Fri, 20 Aug 2021 13:20:09 -0300 Subject: [PATCH 4/7] Pull --- .github/workflows/PullRequest.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml index aafa1f5..a92ac5d 100644 --- a/.github/workflows/PullRequest.yml +++ b/.github/workflows/PullRequest.yml @@ -80,4 +80,8 @@ jobs: platforms: linux/${{ matrix.arch }} - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" - run: docker run --rm -i -e DebugArch="true" coretest:latest@${{ steps.DockerArch.outputs.digest }} + if: matrix.arch == "amd64" + run: docker run --rm -i -e DebugArch="true" coretest:latest + - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" + if: matrix.arch != "amd64" + run: docker run --rm -i -e DebugArch="true" coretest:latest@${{ steps.DockerArch.outputs.digest }} \ No newline at end of file -- 2.50.0 From 81f45d6b087a58b77d3fa33a644e0e36a480c637 Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Fri, 20 Aug 2021 13:22:55 -0300 Subject: [PATCH 5/7] Pull --- .github/workflows/PullRequest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml index a92ac5d..404af42 100644 --- a/.github/workflows/PullRequest.yml +++ b/.github/workflows/PullRequest.yml @@ -80,8 +80,8 @@ jobs: platforms: linux/${{ matrix.arch }} - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" - if: matrix.arch == "amd64" + if: ${{ matrix.arch }} == "amd64" run: docker run --rm -i -e DebugArch="true" coretest:latest - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" - if: matrix.arch != "amd64" + if: ${{ matrix.arch }} != "amd64" run: docker run --rm -i -e DebugArch="true" coretest:latest@${{ steps.DockerArch.outputs.digest }} \ No newline at end of file -- 2.50.0 From dae7a44afde292fccb82d58cb54c11214857f802 Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Fri, 20 Aug 2021 13:31:04 -0300 Subject: [PATCH 6/7] pull --- .github/workflows/PullRequest.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml index 404af42..4359a60 100644 --- a/.github/workflows/PullRequest.yml +++ b/.github/workflows/PullRequest.yml @@ -71,17 +71,21 @@ jobs: - name: checkout uses: actions/checkout@master - - name: Build Docker Image + - name: Docker build amd64 + if: ${{ matrix.arch }} == "amd64" + run: docker build -t coretest:latest . + - name: "Run Docker Image" + if: ${{ matrix.arch }} == "amd64" + run: docker run --rm -i -e DebugArch="true" coretest:latest + + - name: Build Docker Image (Multiarch) + if: ${{ matrix.arch }} != "amd64" id: DockerArch uses: docker/build-push-action@v2 with: target: bdscore - tags: coretest:latest + tags: coretestarch:latest platforms: linux/${{ matrix.arch }} - - - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" - if: ${{ matrix.arch }} == "amd64" - run: docker run --rm -i -e DebugArch="true" coretest:latest - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" if: ${{ matrix.arch }} != "amd64" - run: docker run --rm -i -e DebugArch="true" coretest:latest@${{ steps.DockerArch.outputs.digest }} \ No newline at end of file + run: docker run --rm -i -e DebugArch="true" coretestarch:latest@${{ steps.DockerArch.outputs.digest }} \ No newline at end of file -- 2.50.0 From 2ea89fcc9739ff445f39f67f36be581bb2364c16 Mon Sep 17 00:00:00 2001 From: Matheus Sampaio Queiroga Date: Fri, 20 Aug 2021 13:43:58 -0300 Subject: [PATCH 7/7] Remove run --- .github/workflows/PullRequest.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml index 4359a60..1086ea2 100644 --- a/.github/workflows/PullRequest.yml +++ b/.github/workflows/PullRequest.yml @@ -71,21 +71,10 @@ jobs: - name: checkout uses: actions/checkout@master - - name: Docker build amd64 - if: ${{ matrix.arch }} == "amd64" - run: docker build -t coretest:latest . - - name: "Run Docker Image" - if: ${{ matrix.arch }} == "amd64" - run: docker run --rm -i -e DebugArch="true" coretest:latest - - name: Build Docker Image (Multiarch) - if: ${{ matrix.arch }} != "amd64" id: DockerArch uses: docker/build-push-action@v2 with: target: bdscore tags: coretestarch:latest - platforms: linux/${{ matrix.arch }} - - name: "Run Docker Image, digiest: ${{ steps.DockerArch.outputs.digest }}" - if: ${{ matrix.arch }} != "amd64" - run: docker run --rm -i -e DebugArch="true" coretestarch:latest@${{ steps.DockerArch.outputs.digest }} \ No newline at end of file + platforms: linux/${{ matrix.arch }} \ No newline at end of file -- 2.50.0