Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAE-24324 Adapt Management Of Nexus Staging Repositories to Nexus 3 #725

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
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
42 changes: 42 additions & 0 deletions .github/actions/nexus-associate-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Associate tag with artifacts
description: Associate tag with artifacts in Nexus
inputs:
tag-name:
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
description: The name of the tag
required: true
nexus-username:
description: Nexus user name
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
required: true
nexus-password:
description: Nexus password
required: true
nexus-url:
description: Base URL to the Nexus server
required: false
default: "https://artifacts.alfresco.com/nexus"
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
group-id:
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
description: The maven group-id of the component
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
required: true
version:
description: The version of the component
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
required: true

runs:
using: composite
steps:
- name: associate-tag
id: associate-tag
shell: bash
env:
TAG_NAME: ${{ inputs.tag-name }}
NEXUS_USERNAME: ${{ inputs.nexus-username }}
NEXUS_PASSWORD: ${{ inputs.nexus-password }}
NEXUS_URL: ${{ inputs.nexus-url }}
GROUP-ID: ${{ inputs.group }}
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
VERSION: ${{ inputs.version }}
run: |
echo "Associating tag $TAG_NAME with component $GROUP:$VERSION"
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
curl -u "${NEXUS_USERNAME}":"${NEXUS_PASSWORD}" \
-X POST "${NEXUS_URL}/service/rest/v1/tags/associate/${TAG_NAME}&group=${GROUP-ID}&version=${VERSION}" \
-H "Content-Type:application/json" \
-d '{}'
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
atchertchian marked this conversation as resolved.
Show resolved Hide resolved
39 changes: 39 additions & 0 deletions .github/actions/nexus-create-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Create nexus tag
description: Create a tag in Nexus
inputs:
tag-name:
description: The name of the tag to be created
required: true
nexus-username:
description: Nexus user name
required: true
nexus-password:
description: Nexus password
required: true
nexus-url:
description: Base URL to the Nexus server
required: false
default: "https://artifacts.alfresco.com/nexus"
outputs:
tag-name-created:
description: The name of the tag created
value: ${{ steps.create-nexus-tag.outputs.tag-name-created }}

runs:
using: composite
steps:
- name: create-nexus-tag
id: create-nexus-tag
shell: bash
env:
TAG_NAME: ${{ inputs.tag-name }}
NEXUS_USERNAME: ${{ inputs.nexus-username }}
NEXUS_PASSWORD: ${{ inputs.nexus-password }}
NEXUS_URL: ${{ inputs.nexus-url }}
run: |
echo "Creating tag $TAG_NAME in Nexus"
curl -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" \
-X POST --header 'Content-Type: application/json' \
"${NEXUS_URL}/service/rest/v1/tags" \
-d "{\"name\":\"$TAG_NAME\"}"
echo "tag-name-created=$TAG_NAME" >> $GITHUB_OUTPUT
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
38 changes: 38 additions & 0 deletions .github/actions/nexus-move-artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Move artifacts to destination repository
description: Move artifacts to destination repository in Nexus
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
inputs:
tag-name:
description: The name of the tag
required: true
nexus-username:
description: Nexus user name
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
required: true
nexus-password:
description: Nexus password
required: true
nexus-url:
description: Base URL to the Nexus server
required: false
default: "https://artifacts.alfresco.com/nexus"
destination-repository:
description: The destination repository
required: true

runs:
using: composite
steps:
- name: move artifacts
id: move artifacts
shell: bash
env:
TAG_NAME: ${{ inputs.tag-name }}
NEXUS_USERNAME: ${{ inputs.nexus-username }}
NEXUS_PASSWORD: ${{ inputs.nexus-password }}
NEXUS_URL: ${{ inputs.nexus-url }}
DESTINATION_REPOSITORY: ${{ inputs.destination-repository }}
run: |
echo "Move artifacts with tag $TAG_NAME to staging repository $STAGING_REPOSITORY"
curl -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" \
-X POST "${NEXUS_URL}/service/rest/v1/tags/move/{DESTINATION_REPOSITORY}?tag=${TAG_NAME}" \
-H 'accept: application/json' \
-d '{}'
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ updates:
catch-all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-associate-tag"
schedule:
interval: "weekly"
groups:
catch-all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-close-staging"
schedule:
Expand All @@ -401,6 +409,22 @@ updates:
catch-all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-create-tag"
schedule:
interval: "weekly"
groups:
catch-all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-move-artifacts"
schedule:
interval: "weekly"
groups:
catch-all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/.github/actions/nexus-release-staging"
schedule:
Expand Down
46 changes: 46 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ Here follows the list of GitHub Actions topics available in the current document
- [maven-release](#maven-release)
- [maven-update-pom-version](#maven-update-pom-version)
- [nexus-create-staging](#nexus-create-staging)
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
- [nexus-create-tag](#nexus-create-tag)
- [nexus-associate-tag](#nexus-associate-tag)
- [nexus-move-artifacts](#nexus-move-artifacts)
- [nexus-close-staging](#nexus-close-staging)
- [nexus-release-staging](#nexus-release-staging)
- [pre-commit](#pre-commit)
Expand Down Expand Up @@ -1042,6 +1045,49 @@ The resulting staging repository will be available in the output named `staging-
nexus-password: "${{ secrets.NEXUS_PASSWORD }}"
```

### nexus-create-tag

Creates a tag on Nexus with a specific name. The resulting tag will be available in the output named `tag-name`.
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved

```yaml
- uses: Alfresco/alfresco-build-tools/.github/actions/nexus-create-tag@ref
with:
tag-name: ${{ needs.load-release-info.outputs.version }}
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
nexus-username: ${{ secrets.NEXUS_USERNAME }}
nexus-password: ${{ secrets.NEXUS_PASSWORD }}
```

### nexus-associate-tag

Associates tag to artifacts on Nexus. The artifacts are filtered by provided maven group-id and version and then associated with the provided tag.
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved

```yaml
- uses: Alfresco/alfresco-build-tools/.github/actions/nexus-associate-tags@ref
with:
tag-name: ${{needs.load-release-info.outputs.version }}
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
nexus-username: ${{ secrets.NEXUS_USERNAME }}
nexus-password: ${{ secrets.NEXUS_PASSWORD }}
group-id: maven-group-id
version: ${{ steps.load-descriptor.outputs.version }}
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved
```

Assuming `maven-group-id` is the group id of the artifacts to be associated with the tag.

### nexus-move-artifacts

Moves artifacts from one repository to another on Nexus. The action moves the artifacts associated with a particular tag to the destination repository.
revatilimaye marked this conversation as resolved.
Show resolved Hide resolved

```yaml
- uses: Alfresco/alfresco-build-tools/.github/actions/nexus-move-artifacts@ref
with:
tag-name: ${{ needs.load-release-info.outputs.version }}
destination-repository: destination-repository
nexus-username: ${{ secrets.NEXUS_USERNAME }}
nexus-password: ${{ secrets.NEXUS_PASSWORD }}
```

Assuming `destination-repository` is the repository where the artifacts will be moved.

### nexus-close-staging

Closes the specified staging repository on Nexus.
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v6.1.0
v6.2.0
Loading