Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions config-gradle/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ runs:
development/artifactory/token/{REPO_OWNER_NAME_DASH}-${{ env.ARTIFACTORY_READER_ROLE }} access_token | ARTIFACTORY_ACCESS_TOKEN;
${{ inputs.use-develocity == 'true' && 'development/kv/data/develocity token | DEVELOCITY_TOKEN;' || '' }}

- name: Extract Develocity hostname
id: develocity-hostname
if: steps.config-gradle-completed.outputs.skip != 'true' && inputs.use-develocity == 'true'
shell: bash
run: echo "hostname=$(echo '${{ inputs.develocity-url }}' | sed -e 's|https://||' -e 's|/$||')" >> $GITHUB_OUTPUT

- name: Set environment variables for Artifactory authentication
if: steps.config-gradle-completed.outputs.skip != 'true'
shell: bash
Expand All @@ -116,7 +122,7 @@ runs:
&& fromJSON(steps.secrets.outputs.vault).DEVELOCITY_TOKEN
|| '' }}
run: |
if [[ "${DEVELOCITY_ACCESS_KEY:-}" == "develocity.sonar.build=" ]]; then
if [[ "${DEVELOCITY_ACCESS_KEY:-}" == "${{ steps.develocity-hostname.outputs.hostname }}=" ]]; then
echo "::warning title=Found invalid DEVELOCITY_ACCESS_KEY::DEVELOCITY_ACCESS_KEY should not be set manually in the environment."
echo "[WARNING] DEVELOCITY_ACCESS_KEY is set in the environment with an empty token. This is a deprecated configuration." \
"The Develocity token is configured by config-gradle. Please remove external configuration of DEVELOCITY_ACCESS_KEY."
Expand All @@ -128,7 +134,7 @@ runs:
echo "ARTIFACTORY_ACCESS_TOKEN=$ARTIFACTORY_ACCESS_TOKEN" >> "$GITHUB_ENV"
echo "ARTIFACTORY_PASSWORD=$ARTIFACTORY_ACCESS_TOKEN" >> "$GITHUB_ENV" # deprecated, backward compliance
if [[ -n "${DEVELOCITY_TOKEN:-}" ]]; then
echo "DEVELOCITY_ACCESS_KEY=develocity.sonar.build=$DEVELOCITY_TOKEN" >> "$GITHUB_ENV"
echo "DEVELOCITY_ACCESS_KEY=${{ steps.develocity-hostname.outputs.hostname }}=$DEVELOCITY_TOKEN" >> "$GITHUB_ENV"
fi

# Configure Gradle for comprehensive caching and build summary reporting. It does not install Gradle.
Expand All @@ -139,6 +145,8 @@ runs:
develocity-injection-enabled: ${{ inputs.use-develocity == 'true' }}
cache-disabled: true
develocity-plugin-version: '4.0'
develocity-access-key: ${{ inputs.use-develocity == 'true' &&
fromJSON(steps.secrets.outputs.vault).DEVELOCITY_TOKEN || '' }}

- name: Generate Gradle Cache Key
if: steps.config-gradle-completed.outputs.skip != 'true' && inputs.disable-caching != 'true'
Expand Down Expand Up @@ -180,12 +188,6 @@ runs:
shell: bash
run: ${GITHUB_ACTION_PATH}/set_gradle_project_version.sh

- name: Extract Develocity hostname
id: develocity-hostname
if: steps.config-gradle-completed.outputs.skip != 'true' && inputs.use-develocity == 'true'
shell: bash
run: echo "hostname=$(echo '${{ inputs.develocity-url }}' | sed 's|https://||' | sed 's|/$||')" >> $GITHUB_OUTPUT

- name: Deactivate UseContainerSupport on github-ubuntu-* runners
if: steps.config-gradle-completed.outputs.skip != 'true' && runner.os == 'Linux' && runner.environment == 'github-hosted'
shell: bash
Expand Down
10 changes: 8 additions & 2 deletions config-maven/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ runs:
development/artifactory/token/{REPO_OWNER_NAME_DASH}-${{ env.ARTIFACTORY_READER_ROLE }} access_token | ARTIFACTORY_ACCESS_TOKEN;
${{ inputs.use-develocity == 'true' && 'development/kv/data/develocity token | DEVELOCITY_TOKEN;' || '' }}

- name: Extract Develocity hostname
id: develocity-hostname
if: steps.from-env.outputs.skip != 'true' && inputs.use-develocity == 'true'
shell: bash
run: echo "hostname=$(echo '${{ inputs.develocity-url }}' | sed -e 's|https://||' -e 's|/$||')" >> $GITHUB_OUTPUT

- name: Set environment variables for Artifactory authentication
if: steps.from-env.outputs.skip != 'true'
shell: bash
Expand All @@ -113,7 +119,7 @@ runs:
DEVELOCITY_TOKEN: ${{ inputs.use-develocity == 'true' && steps.secrets.outputs.vault &&
fromJSON(steps.secrets.outputs.vault).DEVELOCITY_TOKEN || '' }}
run: |
if [[ "${DEVELOCITY_ACCESS_KEY:-}" == "develocity.sonar.build=" ]]; then
if [[ "${DEVELOCITY_ACCESS_KEY:-}" == "${{ steps.develocity-hostname.outputs.hostname }}=" ]]; then
echo "::warning title=Found invalid DEVELOCITY_ACCESS_KEY::DEVELOCITY_ACCESS_KEY should not be set manually in the environment."
echo "[WARNING] DEVELOCITY_ACCESS_KEY is set in the environment with an empty token. This is a deprecated configuration." \
"The Develocity token is configured by config-maven. Please remove external configuration of DEVELOCITY_ACCESS_KEY."
Expand All @@ -125,7 +131,7 @@ runs:
echo "ARTIFACTORY_ACCESS_TOKEN=$ARTIFACTORY_ACCESS_TOKEN" >> "$GITHUB_ENV"
echo "ARTIFACTORY_PASSWORD=$ARTIFACTORY_ACCESS_TOKEN" >> "$GITHUB_ENV" # deprecated, backward compliance
if [[ -n "${DEVELOCITY_TOKEN:-}" ]]; then
echo "DEVELOCITY_ACCESS_KEY=develocity.sonar.build=$DEVELOCITY_TOKEN" >> "$GITHUB_ENV"
echo "DEVELOCITY_ACCESS_KEY=${{ steps.develocity-hostname.outputs.hostname }}=$DEVELOCITY_TOKEN" >> "$GITHUB_ENV"
fi

- name: Configure Maven settings and set repository URL
Expand Down
Loading