-
Notifications
You must be signed in to change notification settings - Fork 6
Client 3872 add ci scripts #64
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
Open
gagan405
wants to merge
66
commits into
stage
Choose a base branch
from
CLIENT-3872-add-ci-scripts
base: stage
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
7420b86
updated javadoc parsing logic
gagan405 6f44b54
update commit hash
gagan405 8effb30
add missing variable
gagan405 fe48c70
add missing variable
gagan405 85aa03e
add missing variable
gagan405 4782328
porting publish scripts from hava client
gagan405 514b6dd
fixed project name, cleaned up jdk versioning
gagan405 cad18b9
remove git hash from ueses reference
gagan405 bda2344
comment out any update code for testing
gagan405 fa5dfa2
add wf run against pull request
gagan405 3a877d4
hard code build number
gagan405 dad401f
fix working directory, add debug statements
gagan405 4e55324
fix parsing commit hash, promote build only for the root name
gagan405 3b62340
fix build name
gagan405 83d7634
fix build name
gagan405 2dca316
remove multi-module to single one
gagan405 a762246
force GH to find the wf in PR branch
gagan405 6e28e83
fix build name number for the next stage
gagan405 6f1d672
output artifact version as single string
gagan405 e4fda14
change build name to match the maven artifact
gagan405 1b8ae36
update build script to reflect latest changes
gagan405 92f03e6
update build script to reflect latest changes
gagan405 a0ce053
update gh workflow and add build info
gagan405 0d54c82
update gh workflow commit
gagan405 bf4786f
still update gh workflow commit
gagan405 73816cd
remove vcs info
gagan405 69291ec
revert to main branch
gagan405 0d4c2a8
test with build 22
gagan405 a3adfb1
updated artifact extraction logic
gagan405 634af3b
updated build-name parsing
gagan405 2dd7215
updated download logic
gagan405 1ca9849
add debug logs
gagan405 27caae8
extract artifact name from path
gagan405 4a478fe
fix input to sonatype step
gagan405 9b8954e
pass artifact version to sonatype step
gagan405 93d9b06
add debug logs for sonatype response
gagan405 c2c96ea
add debug logs for sonatype response
gagan405 5b39186
test sonatype with dummy id
gagan405 7106abc
update version extraction
gagan405 96599ef
fix version extraction
gagan405 d375cc4
fix version extraction
gagan405 e8a0190
debug fix version extraction
gagan405 385c590
use maven to extract version
gagan405 8119a12
minor fix: use maven to extract version
gagan405 5a99854
enable java in version extraction
gagan405 49babed
attempt to fix with sed
gagan405 c24cbb8
fix artifact path
gagan405 fc9be50
fix SNAPSHOT versions in build
gagan405 5c0495e
update build logic to fix snapshot version
gagan405 affe894
include parent pom
gagan405 fb1d9f6
update wf commit to handle SNAPSHOT javadoc jars
gagan405 2e64681
update wf version
gagan405 99d5f0b
update wf hash to handle parent pom
gagan405 9bc1683
update wf hash to handle xmllint
gagan405 d430a95
update wf hash to handle xmllint
gagan405 c6155ad
another upgrade to shared wf
gagan405 6d48e2a
yet another attempt to fix the wf
gagan405 18b63e8
upgrade wf version
gagan405 9cbc8e7
test with build 42
gagan405 0c2dfd3
disable sonatype probing for test
gagan405 1378d01
fix checking is-snapshot from build_info
gagan405 16a32fa
temporarily enable snapshot promotion
gagan405 15300e6
remove trigger on main branch
gagan405 556776e
uncomment the commented portions
gagan405 1242559
add sonatype delete/approve workflow
gagan405 a1d2fa1
fix: remove promotion flow on pull requests
gagan405 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| name: Publish build-info to JFrog | ||
| description: "Publishes build-info to JFrog" | ||
|
|
||
| inputs: | ||
| jfrog-platform-url: | ||
| description: "JFrog platform URL" | ||
| required: false | ||
| default: https://aerospike.jfrog.io | ||
| oidc-provider: | ||
| description: "OIDC provider name" | ||
| required: true | ||
| oidc-audience: | ||
| description: "ODIC audience" | ||
| required: true | ||
| build-path: | ||
| description: "Path to which build info is to be published" | ||
| required: true | ||
| variables: | ||
| description: "Any additional variables to be published as part of build. The input here should be valid JSON in the form {'env_variable_key': 'env_variable_value'}, .e.g {'SONATYPE_STAGING_BUILD_ID': '070c07e25e937888ed9740ee825afa24bf184722'}" | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Debug publish to github | ||
| shell: bash | ||
| run: | | ||
| echo "${{ inputs.jfrog-platform-url }}" | ||
| echo "${{ inputs.build-path }}" | ||
|
|
||
| - name: Set up JFrog credentials | ||
| id: setup-jfrog-cli | ||
| uses: jfrog/setup-jfrog-cli@v4 | ||
| env: | ||
| JF_URL: ${{ inputs.jfrog-platform-url }} | ||
| JF_PROJECT: database | ||
| with: | ||
| version: 2.72.2 | ||
| oidc-provider-name: ${{ inputs.oidc-provider }} | ||
| oidc-audience: ${{ inputs.oidc-audience }} | ||
|
|
||
| # Parsing out env variables and values and setting them in the environment | ||
| - name: Set env variables provided with variables | ||
| shell: bash | ||
| run: | | ||
| ENV_VARIABLES='${{ inputs.variables }}' | ||
| echo "$ENV_VARIABLES" | jq -r 'to_entries | .[] | "\(.key)=\(.value)"' >> $GITHUB_ENV | ||
|
|
||
| # Pushing build info to JFrog | ||
| - name: Upload artifacts | ||
| shell: bash | ||
| run: | | ||
| BUILD_ID=$(echo "${{ inputs.build-path }}" | sed 's/.*_\(.*\)\/.*/\1/') | ||
| BUILD_PATH="promote_${BUILD_ID}" | ||
|
|
||
| # record env variables | ||
| jf rt bce ${BUILD_PATH} ${{ github.run_number }} | ||
|
|
||
| # record git info | ||
| jf rt bag ${BUILD_PATH} ${{ github.run_number }} | ||
|
|
||
| # publish build info | ||
| jf rt bp ${BUILD_PATH} ${{ github.run_number }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| name: Publish artifacts to github | ||
| description: "Publish artifacts to github" | ||
|
|
||
| inputs: | ||
| staging-folder: | ||
| description: "" | ||
| required: false | ||
| default: staging | ||
| target-folder: | ||
| description: "" | ||
| required: false | ||
| default: github | ||
| release-notes: | ||
| description: "Release notes" | ||
| required: true | ||
| github-token: | ||
| description: "Github auth token" | ||
| required: true | ||
| artifact-version: | ||
| description: "Version of the artifact to release" | ||
| required: true | ||
| build-name-number: | ||
| description: "String containing build name, number and jdk versions" | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Debug publish to github | ||
| shell: bash | ||
| run: | | ||
| echo "${{ inputs.staging-folder }}" | ||
| echo "${{ inputs.target-folder }}" | ||
| echo "${{ inputs.artifact-version }}" | ||
| echo "${{ inputs.release-notes }}" | ||
| echo "${{ inputs.build-name-number }}" | ||
|
|
||
| - id: get-artifact-version | ||
| shell: bash | ||
| run: | | ||
| VERSION="${{ inputs.artifact-version }}" | ||
| echo "artifact-version=${VERSION}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Create upload archive for github | ||
| id: create-artifact | ||
| shell: bash | ||
| run: | | ||
| src="${{ inputs.staging-folder }}" | ||
| dest="${{ inputs.target-folder }}" | ||
|
|
||
| find "$src" -type f \ | ||
| -exec cp {} "$dest" \; | ||
|
|
||
| # Listing staged artifacts to be uploaded | ||
| - id: get-github-release-artifact-names | ||
| working-directory: ${{ inputs.target-folder }} | ||
| shell: bash | ||
| run: | | ||
| ARTIFACTS=$(ls | sed "s|^|${{ inputs.target-folder }}/|") | ||
|
|
||
| echo "release-artifacts<<EOF" >> $GITHUB_OUTPUT | ||
| echo "${ARTIFACTS}" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Debug show content of the upload archive | ||
| shell: bash | ||
| run: | | ||
| pwd | ||
| ls ${{ inputs.target-folder }} | sed 's/^//' | ||
|
|
||
| - name: Debug GitHub publish input | ||
| shell: bash | ||
| working-directory: ${{ inputs.target-folder }} | ||
| run: | | ||
| echo "working directory: ${{ inputs.target-folder }}" | ||
| echo "tag name: Release ${{ steps.get-artifact-version.outputs.artifact-version }}" | ||
| echo "body: Changes for release ${{ steps.get-artifact-version.outputs.artifact-version }}" | ||
| echo "body: ${{ inputs.release-notes }}" | ||
| echo "files: ${{ steps.get-github-release-artifact-names.outputs.release-artifacts }}" | ||
|
|
||
| - name: Publish release to github | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| token: ${{ inputs.github-token }} | ||
| tag_name: ${{ steps.get-artifact-version.outputs.artifact-version }} | ||
| body: | | ||
| Changes for release ${{ steps.get-artifact-version.outputs.artifact-version }} | ||
| ${{ inputs.release-notes }} | ||
| draft: true | ||
| prerelease: false | ||
| files: ${{ steps.get-github-release-artifact-names.outputs.release-artifacts }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| name: Publish artifacts to Sonatype | ||
| description: "Publishes artifacts to Sonatype" | ||
|
|
||
| inputs: | ||
| staging-folder: | ||
| description: "Folder to which the artifacts are copied" | ||
| required: false | ||
| default: staging | ||
| target-folder: | ||
| description: "Subfolder in the staging folder where the artifacts are copied" | ||
| required: false | ||
| default: sonatype | ||
| publish-user: | ||
| description: "Username for publishing to Sonatype" | ||
| required: true | ||
| publish-password: | ||
| description: "Password for publishing to Sonatype" | ||
| required: true | ||
| validation-max-number-checks: | ||
| description: "Number of checks we will conduct to check if the package is validated" | ||
| required: true | ||
| sonatype-domain-name: | ||
| description: "Sonatype domain name" | ||
| required: true | ||
| build-name-number: | ||
| required: true | ||
| description: "Build name and number" | ||
| artifact-version: | ||
| description: "Artifact version" | ||
| required: true | ||
|
|
||
| outputs: | ||
| maven-central-release-id: | ||
| description: Maven central id extracted from staging step to maven central | ||
| value: ${{ steps.get-maven-central-release-id.outputs.maven-central-release-id }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Debug publish to github | ||
| shell: bash | ||
| run: | | ||
| echo "${{ inputs.staging-folder }}" | ||
| echo "${{ inputs.target-folder }}" | ||
| echo "${{ inputs.sonatype-domain-name }}" | ||
| echo "${{ inputs.build-name-number }}" | ||
| echo "${{ inputs.artifact-version }}" | ||
|
|
||
| # For Maven Central we need to filter out the jar-with-dependencies | ||
| # as it is not allowed to be uploaded to Maven Central | ||
| - name: Copy artifacts with filter to sonatype stage folder | ||
| shell: bash | ||
| working-directory: ${{ inputs.staging-folder }} | ||
| run: | | ||
| src="./" | ||
| dest=../"${{ inputs.target-folder }}" | ||
|
|
||
| find "$src" -type f \ | ||
| \! \( -name "*jar-with-dependencies*" \) \ | ||
| -exec cp --parents {} "$dest" \; | ||
|
|
||
| - name: Debug target folder contents | ||
| shell: bash | ||
| working-directory: ${{ inputs.target-folder }} | ||
| run: | | ||
| echo "Current directory: $(pwd)" | ||
| echo "Contents:" | ||
| ls -laR | ||
|
|
||
| # Creates uploadable archive | ||
| - name: Create upload archive for sonatype | ||
| id: create-artifact | ||
| shell: bash | ||
| working-directory: ${{ inputs.target-folder }} | ||
| run: | | ||
| # Use the actual artifact version, not parsed from build-name-number | ||
| RELEASE="${{ inputs.artifact-version }}" | ||
| # Extract just the build number from build-name-number | ||
| RELEASE_BUILD_NUMBER=$(echo "${{ inputs.build-name-number }}" | sed -E 's/.*\/([^/]+)$/\1/') | ||
| ARTIFACT_NAME="${RELEASE}_${RELEASE_BUILD_NUMBER}" | ||
|
|
||
| echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT | ||
| zip -r "${ARTIFACT_NAME}" . | ||
|
|
||
| - name: Debug show content of the upload archive | ||
| shell: bash | ||
| working-directory: ${{ inputs.target-folder }} | ||
| run: | | ||
| ARTIFACT_NAME='${{ steps.create-artifact.outputs.artifact-name }}' | ||
| unzip -l "${ARTIFACT_NAME}" | tail -n +4 | sort -k4,4 | ||
|
|
||
| # Call to Maven Central to stage the release/artifact | ||
| - name: Stage artifacts | ||
| id: stage-release | ||
| working-directory: ${{ inputs.target-folder }} | ||
| shell: bash | ||
| run: | | ||
| TOKEN=$(printf "${{ inputs.publish-user }}:${{ inputs.publish-password }}" | base64) | ||
|
|
||
| echo "curl --request POST --verbose --header 'Authorization: Bearer ${TOKEN}' --form bundle=@${{ steps.create-artifact.outputs.artifact-name }}.zip ${{ inputs.sonatype-domain-name }}/api/v1/publisher/upload?publishingType=USER_MANAGED" | ||
| echo stage-release-id=$(curl --request POST --silent --header "Authorization: Bearer ${TOKEN}" --form bundle=@${{ steps.create-artifact.outputs.artifact-name }}.zip ${{ inputs.sonatype-domain-name }}/api/v1/publisher/upload?publishingType=USER_MANAGED) >> $GITHUB_OUTPUT | ||
|
|
||
| # Validation check loop | ||
| - name: Check validation | ||
| working-directory: ${{ inputs.target-folder }} | ||
| shell: bash | ||
| run: | | ||
| # Correct: Sonatype Publisher API uses Basic auth, not Bearer | ||
| TOKEN=$(printf "%s:%s" "${{ inputs.publish-user }}" "${{ inputs.publish-password }}" | base64) | ||
|
|
||
| NUMBER_OF_CHECKS=${{ inputs.validation-max-number-checks }} | ||
|
|
||
| echo "Starting Sonatype validation checks (max: ${NUMBER_OF_CHECKS})" | ||
|
|
||
| for ((i = 1; i <= NUMBER_OF_CHECKS; i++)); do | ||
| RESPONSE=$(curl --verbose --show-error \ | ||
| --request POST \ | ||
| --header "Authorization: Bearer ${TOKEN}" \ | ||
| "${{ inputs.sonatype-domain-name }}/api/v1/publisher/status?id=${DUMMY_ID}") | ||
|
|
||
| # Validate JSON and extract deploymentState | ||
| SONATYPE_RESPONSE=$(echo "${RESPONSE}" | jq -r '.deploymentState // "NULL"') | ||
|
|
||
| if [[ "${SONATYPE_RESPONSE}" == "FAILED" ]]; then | ||
| ERRORS=$(echo "${RESPONSE}" | jq '.errors // "Unknown error"') | ||
| echo "Package validation failed." | ||
| echo "Errors: ${ERRORS}" | ||
| exit 1 | ||
|
|
||
| elif [[ "${SONATYPE_RESPONSE}" == "VALIDATING" || "${SONATYPE_RESPONSE}" == "PENDING" ]]; then | ||
| echo "Package validation is not done. Status: ${SONATYPE_RESPONSE}" | ||
|
|
||
| # Exponential backoff | ||
| sleep_time=$((2 ** (i - 1))) | ||
| echo "Next retry in ${sleep_time} seconds..." | ||
| sleep "${sleep_time}" | ||
|
|
||
| elif [[ "${SONATYPE_RESPONSE}" == "VALIDATED" ]]; then | ||
| echo "Package successfully validated." | ||
| exit 0 | ||
|
|
||
| else | ||
| echo "Unknown response from Sonatype: ${SONATYPE_RESPONSE}" | ||
| echo "Full payload:" | ||
| echo "${RESPONSE}" | ||
| fi | ||
| done | ||
|
|
||
| echo "Validation timed out after ${NUMBER_OF_CHECKS} attempts." | ||
| exit 1 | ||
|
|
||
| # Peculating up the maven central release id | ||
| - name: Maven Central release id | ||
| working-directory: ${{ inputs.target-folder }} | ||
| id: get-maven-central-release-id | ||
| shell: bash | ||
| run: | | ||
| echo "maven-central-release-id=${{ steps.stage-release.outputs.stage-release-id }}" >> $GITHUB_OUTPUT | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.