Skip to content

Commit

Permalink
AAE-24324 Adapt Management Of Nexus Staging Repositories to Nexus 3 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
revatilimaye authored Sep 2, 2024
1 parent dee7ddb commit 077fcef
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .github/actions/maven-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ runs:
-Dmaven.compiler.release="${JAVA_VERSION}" \
-Dmaven.artifact.threads=30 \
--batch-mode \
-DaltReleaseDeploymentRepository=nexus-releases-staging-fixed::default::"${NEXUS_URL}"/service/local/staging/deployByRepositoryId/"$STAGING_REPOSITORY_ID " \
-DaltReleaseDeploymentRepository=nexus-releases-staging-fixed::default::"${NEXUS_URL}"/content/repositories/"$STAGING_REPOSITORY_ID " \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
Expand Down
90 changes: 0 additions & 90 deletions .github/actions/nexus-close-staging/action.yml

This file was deleted.

This file was deleted.

58 changes: 0 additions & 58 deletions .github/actions/nexus-create-staging/action.yml

This file was deleted.

This file was deleted.

71 changes: 71 additions & 0 deletions .github/actions/nexus-move-artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Move artifacts to destination repository
description: Move artifacts to destination repository in Nexus 3
inputs:
nexus-username:
description: Nexus username
required: true
nexus-password:
description: Nexus password
required: true
nexus-url:
description: Base URL to the Nexus server
required: true
destination-repository:
description: The destination repository
required: true
source-repository:
description: The source repository
required: true
group:
description: The maven group-id of the components to be moved
required: true
version:
description: The version of the components to be moved
required: true

runs:
using: composite
steps:
- name: count-artifacts
id: count-artifacts
shell: bash
env:
NEXUS_USERNAME: ${{ inputs.nexus-username }}
NEXUS_PASSWORD: ${{ inputs.nexus-password }}
NEXUS_URL: ${{ inputs.nexus-url }}
SOURCE_REPOSITORY: ${{ inputs.source-repository }}
GROUP: ${{ inputs.group }}
VERSION: ${{ inputs.version }}
run: |
echo "Counting artifacts in repository ${SOURCE_REPOSITORY} in Nexus"
search_response=$(curl -sSf -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" \
-X GET "${NEXUS_URL}/service/rest/v1/search?repository=${SOURCE_REPOSITORY}&group=${GROUP}&version=${VERSION}" \
-H 'Content-Type: application/json' \
-H 'accept: application/json' \
-d '{}')
count=$(echo "$search_response" | yq '.items | length')
echo "count=$count" >> $GITHUB_OUTPUT
- name: move-artifacts
id: move-artifacts
shell: bash
env:
NEXUS_USERNAME: ${{ inputs.nexus-username }}
NEXUS_PASSWORD: ${{ inputs.nexus-password }}
NEXUS_URL: ${{ inputs.nexus-url }}
DESTINATION_REPOSITORY: ${{ inputs.destination-repository }}
SOURCE_REPOSITORY: ${{ inputs.source-repository }}
GROUP: ${{ inputs.group }}
VERSION: ${{ inputs.version }}
run: |
count="${{ steps.count-artifacts.outputs.count }}"
if [ $count -eq 0 ]; then
echo "No artifacts found in repository ${SOURCE_REPOSITORY} for group ${GROUP} and version ${VERSION}"
else
echo "Moving artifacts to destination repository ${DESTINATION_REPOSITORY} from source repository ${SOURCE_REPOSITORY} in Nexus"
curl -sSf -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" \
-X POST "${NEXUS_URL}/service/rest/v1/staging/move/${DESTINATION_REPOSITORY}?repository=${SOURCE_REPOSITORY}&group=${GROUP}&version=${VERSION}" \
-H 'Content-Type: application/json' \
-H 'accept: application/json' \
-d '{}'
fi
78 changes: 0 additions & 78 deletions .github/actions/nexus-release-staging/action.yml

This file was deleted.

This file was deleted.

18 changes: 1 addition & 17 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,23 +386,7 @@ updates:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-close-staging"
schedule:
interval: "weekly"
groups:
catch-all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-create-staging"
schedule:
interval: "weekly"
groups:
catch-all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-release-staging"
directory: "/.github/actions/nexus-move-artifacts"
schedule:
interval: "weekly"
groups:
Expand Down
Loading

0 comments on commit 077fcef

Please sign in to comment.