From 3d47fcfd03dce6229c39f59f301bed960486e7cc Mon Sep 17 00:00:00 2001 From: everpcpc Date: Tue, 16 Jul 2024 17:05:14 +0800 Subject: [PATCH] chore(ci): setup license with mask (#16061) * chore(ci): mask license * z * z * z * z * z * z --- .github/actions/setup_license/action.yml | 33 ++++++++++ .github/workflows/reuse.linux.yml | 80 ++++++------------------ .github/workflows/reuse.sqllogic.yml | 42 ++----------- Cargo.toml | 1 + 4 files changed, 60 insertions(+), 96 deletions(-) create mode 100644 .github/actions/setup_license/action.yml diff --git a/.github/actions/setup_license/action.yml b/.github/actions/setup_license/action.yml new file mode 100644 index 0000000000000..6ce6167fc6c47 --- /dev/null +++ b/.github/actions/setup_license/action.yml @@ -0,0 +1,33 @@ +name: "Setup License" +description: "Setup Databend Enterprise License" +inputs: + runner_provider: + description: "Self-hosted runner provider, aws or gcp" + required: true + default: "aws" + +runs: + using: "composite" + steps: + - name: Get License from S3 + if: inputs.runner_provider == 'aws' + shell: bash + run: | + aws s3 cp s3://databend-ci/misc/license.key license.key + aws s3 cp s3://databend-ci/misc/license.json license.json + + - name: Get License from GCS + if: inputs.runner_provider == 'gcp' + shell: bash + run: | + gcloud storage cp gs://databend-ci/misc/license.key license.key + gcloud storage cp gs://databend-ci/misc/license.json license.json + + - name: Output License + shell: bash + run: | + license=$(cat license.key) + rm license.key + echo "::add-mask::${license}" + echo "QUERY_DATABEND_ENTERPRISE_LICENSE=${license}" >> $GITHUB_ENV + cat license.json diff --git a/.github/workflows/reuse.linux.yml b/.github/workflows/reuse.linux.yml index 416298fb08a1d..735eff0ed03c3 100644 --- a/.github/workflows/reuse.linux.yml +++ b/.github/workflows/reuse.linux.yml @@ -31,28 +31,6 @@ jobs: with: github_token: ${{ github.token }} - license: - runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - outputs: - license: ${{ steps.license.outputs.license }} - steps: - - uses: actions/checkout@v4 - - name: Get License from S3 - if: inputs.runner_provider == 'aws' - run: | - aws s3 cp s3://databend-ci/misc/license.key license.key - aws s3 cp s3://databend-ci/misc/license.json license.json - - name: Get License from GCS - if: inputs.runner_provider == 'gcp' - run: | - gcloud storage cp gs://databend-ci/misc/license.key license.key - gcloud storage cp gs://databend-ci/misc/license.json license.json - - name: Output License - id: license - run: | - echo "license=$(cat license.key | base64 -w 0)" >> $GITHUB_OUTPUT - cat license.json - build: runs-on: - self-hosted @@ -215,16 +193,13 @@ jobs: test_stateless_cluster: runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - needs: [build, check, license] + needs: [build, check] steps: - uses: actions/checkout@v4 - - name: Decode license - id: license - run: | - echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/setup_license + with: + runner_provider: ${{ inputs.runner_provider }} - uses: ./.github/actions/test_stateless_cluster_linux - env: - QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} timeout-minutes: 15 test_stateful_standalone: @@ -242,16 +217,13 @@ jobs: test_stateful_cluster: runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - needs: [build, check, license] + needs: [build, check] steps: - uses: actions/checkout@v4 - - name: Decode license - id: license - run: | - echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/setup_license + with: + runner_provider: ${{ inputs.runner_provider }} - uses: ./.github/actions/test_stateful_cluster_linux - env: - QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} timeout-minutes: 15 - name: Upload failure if: failure() @@ -291,19 +263,15 @@ jobs: # continue-on-error: true test_ee_standalone: - needs: [build, check, license] + needs: [build, check] runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - if: needs.license.outputs.license steps: - uses: actions/checkout@v4 - - name: Decode license - id: license - run: | - echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/setup_license + with: + runner_provider: ${{ inputs.runner_provider }} - uses: ./.github/actions/test_ee_standalone_linux timeout-minutes: 10 - env: - QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} - name: Upload failure if: failure() uses: ./.github/actions/artifact_failure @@ -311,20 +279,16 @@ jobs: name: test-stateful-standalone-linux test_ee_standalone_background: - needs: [build, check, license] + needs: [build, check] runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - if: needs.license.outputs.license steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup_bendsql - - name: Decode license - id: license - run: | - echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/setup_license + with: + runner_provider: ${{ inputs.runner_provider }} - uses: ./.github/actions/test_ee_standalone_background_linux timeout-minutes: 10 - env: - QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} - name: Upload failure if: failure() uses: ./.github/actions/artifact_failure @@ -332,20 +296,16 @@ jobs: name: test-stateful-standalone-linux test_ee_management_mode: - needs: [build, check, license] + needs: [build, check] runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - if: needs.license.outputs.license steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup_bendsql - - name: Decode license - id: license - run: | - echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/setup_license + with: + runner_provider: ${{ inputs.runner_provider }} - uses: ./.github/actions/test_ee_management_mode_linux timeout-minutes: 10 - env: - QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} - name: Upload failure if: failure() uses: ./.github/actions/artifact_failure diff --git a/.github/workflows/reuse.sqllogic.yml b/.github/workflows/reuse.sqllogic.yml index c33b0fae46f32..8dc13db4fd962 100644 --- a/.github/workflows/reuse.sqllogic.yml +++ b/.github/workflows/reuse.sqllogic.yml @@ -19,28 +19,6 @@ env: RUNNER_PROVIDER: ${{ inputs.runner_provider }} jobs: - license: - runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - outputs: - license: ${{ steps.license.outputs.license }} - steps: - - uses: actions/checkout@v4 - - name: Get License from S3 - if: inputs.runner_provider == 'aws' - run: | - aws s3 cp s3://databend-ci/misc/license.key license.key - aws s3 cp s3://databend-ci/misc/license.json license.json - - name: Get License from GCS - if: inputs.runner_provider == 'gcp' - run: | - gcloud storage cp gs://databend-ci/misc/license.key license.key - gcloud storage cp gs://databend-ci/misc/license.json license.json - - name: Output License - id: license - run: | - echo "license=$(cat license.key | base64 -w 0)" >> $GITHUB_OUTPUT - cat license.json - management_mode: runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] steps: @@ -150,7 +128,6 @@ jobs: cluster: runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - needs: license strategy: fail-fast: false matrix: @@ -168,13 +145,10 @@ jobs: - "http" steps: - uses: actions/checkout@v4 - - name: Decode license - id: license - run: | - echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/setup_license + with: + runner_provider: ${{ inputs.runner_provider }} - uses: ./.github/actions/test_sqllogic_cluster_linux - env: - QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} timeout-minutes: 15 with: dirs: ${{ matrix.dirs }} @@ -233,7 +207,6 @@ jobs: ee: runs-on: [self-hosted, X64, Linux, 4c8g, "${{ inputs.runner_provider }}"] - needs: license strategy: fail-fast: false matrix: @@ -242,14 +215,11 @@ jobs: - "native" steps: - uses: actions/checkout@v4 - - name: Decode license - id: license - run: | - echo "license=$(echo '${{ needs.license.outputs.license }}' | base64 -d)" >> $GITHUB_OUTPUT + - uses: ./.github/actions/setup_license + with: + runner_provider: ${{ inputs.runner_provider }} - uses: ./.github/actions/test_ee_sqllogic_standalone_linux timeout-minutes: 15 - env: - QUERY_DATABEND_ENTERPRISE_LICENSE: ${{ steps.license.outputs.license }} with: dirs: ee handlers: mysql,http diff --git a/Cargo.toml b/Cargo.toml index e92613cc32c87..95b18dc7f3f1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -353,6 +353,7 @@ lto = "thin" overflow-checks = false incremental = false opt-level = "s" + # codegen-units = 1 # Reduce number of codegen units to increase optimizations. # [profile.release.package]