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

Migrate maven deploy to artifactory-push CLI #1491

Merged
merged 5 commits into from
Mar 4, 2024
Merged

Conversation

jjchen56
Copy link
Contributor

@jjchen56 jjchen56 commented Mar 4, 2024

All publishing mechanisms outside of artifactory-push will soon be blocked off, so this migrates maven deploy to the artifactory-push CLI.

This change must be made to the job in conjunction, from:

# Only publish master branch commits
if [[ $BRANCH == "master" ]]; then
  set +x
  export KNOX_MACHINE_AUTH=$(hostname)
  export ARTIFACTORY_USER=$(knox get artifacts:prod:use1:token:jenkins_publish_sox:transient_user)
  export ARTIFACTORY_TOKEN=$(knox get artifacts:prod:use1:token:jenkins_publish_sox:access_token)
  set -x
  mvn deploy -pl universal -Dmaven.repo.local=${WORKSPACE}/.m2 -s $WORKSPACE/$SERVICE_DIR/settings.xml
fi

to:

deployment_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ $deployment_version == *-SNAPSHOT ]]; then
  deployment_type=snapshot
else
  deployment_type=release
fi

# Only publish master branch commits
if [[ $BRANCH == "jchen/artifactory-push" ]]; then
  mvn -X deploy -pl universal -Dmaven.repo.local=${WORKSPACE}/.m2 -Ddeployment.type=${deployment_type}
fi

and the change will be made following the merge of this PR.

Tested: https://jenkins-iso-vm.pinadmin.com/job/jchen-test-teletraan/9/console
(this job was cloned from the original build job, teletraan-open-service, and updated with the above changes. Unrelated deployment steps to other non-Artifactory platforms were also removed)

@jjchen56 jjchen56 requested a review from a team as a code owner March 4, 2024 17:46
@github-actions github-actions bot added the deploy-service Includes changes to deploy-service label Mar 4, 2024
@robbintt
Copy link
Contributor

robbintt commented Mar 4, 2024

Thanks, can you describe the test environment setup and how well it matches the existing build environment?

@jjchen56 jjchen56 merged commit fbb862b into master Mar 4, 2024
5 checks passed
@jjchen56 jjchen56 deleted the jchen/artifactory-push branch March 4, 2024 18:40
@jjchen56 jjchen56 restored the jchen/artifactory-push branch March 21, 2024 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-service Includes changes to deploy-service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants