diff --git a/.github/actions/orchestrator-cache/action.yml b/.github/actions/orchestrator-cache/action.yml index a104d7cc0f3..dcb7f912c68 100644 --- a/.github/actions/orchestrator-cache/action.yml +++ b/.github/actions/orchestrator-cache/action.yml @@ -18,12 +18,12 @@ runs: echo "ORCHESTRATOR_HOME=${{ github.workspace }}/orchestrator" >> $GITHUB_ENV - name: Cache Orchestrator - if: inputs.sq-version != 'DEV' + if: github.event_name != 'pull_request' && inputs.sq-version != 'DEV' uses: SonarSource/gh-action_cache@v1 with: path: ${{ env.ORCHESTRATOR_HOME }} - key: orchestrator-${{ inputs.sq-version }}-${{ env.ORCHESTRATOR_CACHE_KEY }}-${{ github.run_id }} - restore-keys: orchestrator-${{ inputs.sq-version }}-${{ env.ORCHESTRATOR_CACHE_KEY }}- + key: orchestrator-production-${{ inputs.sq-version }}-${{ env.ORCHESTRATOR_CACHE_KEY }}-${{ github.run_id }} + restore-keys: orchestrator-production-${{ inputs.sq-version }}-${{ env.ORCHESTRATOR_CACHE_KEY }}- - name: Setup Orchestrator Home Directory shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c37e82b47f..d18c027746b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,6 +112,24 @@ jobs: with: secrets: | development/github/token/licenses-ro token | GITHUB_TOKEN; + development/artifactory-edge-prod/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ORCHESTRATOR_ACCESS_TOKEN; + - name: Configure production Orchestrator + shell: bash + env: + ORCHESTRATOR_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ORCHESTRATOR_ACCESS_TOKEN }} + run: | + umask 077 + config_dir="$RUNNER_TEMP/orchestrator-production-config" + mkdir -p "$config_dir" + printf '%s\n' \ + 'orchestrator.artifactory.url=https://repox-internal.sonar.build/artifactory' \ + "orchestrator.artifactory.accessToken=$ORCHESTRATOR_ACCESS_TOKEN" > "$config_dir/orchestrator.properties" + config_path="$config_dir/orchestrator.properties" + if [[ "$RUNNER_OS" == Windows ]]; then + config_path="/$(cygpath -m "$config_path")" + fi + config_path="${config_path// /%20}" + echo "ORCHESTRATOR_CONFIG_URL=file://$config_path" >> "$GITHUB_ENV" - name: Orchestrator Cache uses: ./.github/actions/orchestrator-cache with: @@ -122,6 +140,7 @@ jobs: MAVEN_OPTS: "-Xmx3g -Dfile.encoding=UTF-8" JAVA_TOOL_OPTIONS: "" GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }} + ORCHESTRATOR_HOME: ${{ github.event_name == 'pull_request' && format('{0}/orchestrator-production', runner.temp) || env.ORCHESTRATOR_HOME }} run: | cd its/ruling extra_args=() @@ -129,7 +148,7 @@ jobs: if [[ "${RUNNER_OS}" != "Windows" ]]; then extra_args+=(-Dparallel=methods -DuseUnlimitedThreads=true) fi - mvn package ${MAVEN_OUTPUT_ARGS} "-Pit-ruling,${{ matrix.item.profile }}" -Dsonar.runtimeVersion=${{ matrix.item.sq_version }} -Dmaven.test.redirectTestOutputToFile=false "${extra_args[@]}" + mvn "-Dorchestrator.configUrl=$ORCHESTRATOR_CONFIG_URL" "-Dorchestrator.home=$ORCHESTRATOR_HOME" package ${MAVEN_OUTPUT_ARGS} "-Pit-ruling,${{ matrix.item.profile }}" -Dsonar.runtimeVersion=${{ matrix.item.sq_version }} -Dmaven.test.redirectTestOutputToFile=false "${extra_args[@]}" - name: Upload Actual Results On Failure if: failure() uses: ./.github/actions/upload-actual @@ -229,6 +248,24 @@ jobs: with: secrets: | development/github/token/licenses-ro token | GITHUB_TOKEN; + development/artifactory-edge-prod/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ORCHESTRATOR_ACCESS_TOKEN; + - name: Configure production Orchestrator + shell: bash + env: + ORCHESTRATOR_ACCESS_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).ORCHESTRATOR_ACCESS_TOKEN }} + run: | + umask 077 + config_dir="$RUNNER_TEMP/orchestrator-production-config" + mkdir -p "$config_dir" + printf '%s\n' \ + 'orchestrator.artifactory.url=https://repox-internal.sonar.build/artifactory' \ + "orchestrator.artifactory.accessToken=$ORCHESTRATOR_ACCESS_TOKEN" > "$config_dir/orchestrator.properties" + config_path="$config_dir/orchestrator.properties" + if [[ "$RUNNER_OS" == Windows ]]; then + config_path="/$(cygpath -m "$config_path")" + fi + config_path="${config_path// /%20}" + echo "ORCHESTRATOR_CONFIG_URL=file://$config_path" >> "$GITHUB_ENV" - name: Orchestrator Cache uses: ./.github/actions/orchestrator-cache with: @@ -236,9 +273,10 @@ jobs: - name: Plugin QA env: GITHUB_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }} + ORCHESTRATOR_HOME: ${{ github.event_name == 'pull_request' && format('{0}/orchestrator-production', runner.temp) || env.ORCHESTRATOR_HOME }} run: | cd its/plugin - mvn package ${MAVEN_OUTPUT_ARGS} -Pit-plugin -Dsonar.runtimeVersion=${{ matrix.sq_version }} -Dmaven.test.redirectTestOutputToFile=false -Dparallel=classes -DuseUnlimitedThreads=true + mvn "-Dorchestrator.configUrl=$ORCHESTRATOR_CONFIG_URL" "-Dorchestrator.home=$ORCHESTRATOR_HOME" package ${MAVEN_OUTPUT_ARGS} -Pit-plugin -Dsonar.runtimeVersion=${{ matrix.sq_version }} -Dmaven.test.redirectTestOutputToFile=false -Dparallel=classes -DuseUnlimitedThreads=true sanity: name: Sanity Test diff --git a/pom.xml b/pom.xml index 47ae74983c9..a10e78a0f28 100644 --- a/pom.xml +++ b/pom.xml @@ -95,7 +95,7 @@ 12.1.1.87771 its/**,java-checks-test-sources/** 2.33.0.5369 - 6.4.3.4676 + 6.4.4.4797 1.3.0.1396 1.26.0.4194 -Xmx512m