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

Automate pushing Che releases to Maven Central #16043

Closed
nickboldt opened this issue Feb 14, 2020 · 9 comments
Closed

Automate pushing Che releases to Maven Central #16043

nickboldt opened this issue Feb 14, 2020 · 9 comments
Assignees
Labels
area/ci CI build and releases, PR testing, & whitelabel/productization issues kind/enhancement A feature request - must adhere to the feature request template.
Milestone

Comments

@nickboldt
Copy link
Contributor

Is your enhancement related to a problem? Please describe.

Today, releases to Maven Central require manual steps to approve/release content.

But there's a nexus mojo that can automate this, as we did for JBoss Tools pushing into the JBoss Nexus repo.

Describe the solution you'd like

Use a Jenkins job to orchestrate the build & release to Maven Central.

pom=${WORKSPACE}/sources/parent/pom.xml

pomVersion=$(grep "<version>" ${pom} | head -1 | sed -e "s#.*<version>\(.\+\)</version>.*#\1#")
MVN="${COMMON_TOOLS}${SEP}maven-3.5.2/bin/mvn -Dmaven.repo.local=${WORKSPACE}/.repository/"
if [[ ${pomVersion} == *"-SNAPSHOT" ]]; then 
  ${MVN} deploy -U -B -f ${pom}
else
  ${MVN} clean deploy -DskipRemoteStaging=true -U -B -f ${pom} \
    -DstagingDescription="[${JOB_NAME} ${BUILD_TIMESTAMP} ${BUILD_NUMBER}] :: ${pomVersion} :: deploy to local" 
  ${MVN} nexus-staging:deploy-staged -f ${pom} \
    -DstagingDescription="[${JOB_NAME} ${BUILD_TIMESTAMP} ${BUILD_NUMBER}] :: ${pomVersion} :: deploy to stage + close"
  ${MVN} nexus-staging:release -f ${pom} \
    -DstagingDescription="[${JOB_NAME} ${BUILD_TIMESTAMP} ${BUILD_NUMBER}] :: ${pomVersion} :: release"
fi

(full job here: https://dev-platform-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/view/Devstudio/view/jbosstools-releng/job/jbosstools-build.parent_master/configure-readonly/)

This requires setting up the nexus-staging plugin in the parent pom, as was done here:

https://github.com/jbosstools/jbosstools-build/blob/master/parent/pom.xml#L520-L532

There may also be some Jenkins master configuration (settings.xml) required to authenticate with the repo as an approved user -- not sure what's required there. But at the very least, if we can't do a nexus-staging:release, we should be able to nexus-staging:deploy-staged to get the bits up into Maven automatically, then only need to do one manual step in Nexus's UI.

Additional context

This is a followup exercise pursuant to streamlining and automating the full Che release process. The first step was getting RELEASE.md files for all the repos.

See also:

@nickboldt nickboldt added kind/enhancement A feature request - must adhere to the feature request template. area/ci CI build and releases, PR testing, & whitelabel/productization issues area/productization labels Feb 14, 2020
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Feb 14, 2020
@nickboldt nickboldt added this to the 7.10.0 milestone Feb 14, 2020
@nickboldt nickboldt removed the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Feb 14, 2020
@nickboldt nickboldt modified the milestones: 7.10.0, 7.11.0 Mar 12, 2020
@nickboldt
Copy link
Contributor Author

Too busy in 7.10. Did not get information from @vparfonov about how to get access to pushing to Maven Central. Need that before we can proceed.

@nickboldt
Copy link
Contributor Author

nickboldt commented Mar 25, 2020

After discussion today, looks like we can improve https://github.com/eclipse/che/blob/master/.ci/cico_common.sh#L87-L96 to add the "if not snapshot then deploy, nexus-staging:deploy-staged, nexus-staging:release" logic into the mvn_deploy() function.

We should also fix https://github.com/eclipse/che/blob/master/.ci/cico_common.sh#L107-L110 to use the devstudio-release bot with email address crw-bots@redhat.com

And we need to stick this block https://github.com/jbosstools/jbosstools-build/blob/master/parent/pom.xml#L520-L532 into the Che parent pom:

			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
				<version>1.6.7</version>
				<extensions>true</extensions>
				<configuration>
					<!-- The Base URL of Nexus instance where we want to stage -->
					<nexusUrl>https://oss.sonatype.org/</nexusUrl>
					<!-- The server "id" element from settings to use authentication from -->
					<serverId>ossrh</serverId>
				</configuration>
			</plugin>
		</plugins>

into https://github.com/eclipse/che-parent/blob/master/pom.xml

@mkuznyetsov
Copy link
Contributor

the nexus-staging plugin is now in use. Now automatic closure of repository is enabled (but not automatic release), which would be done soon, probably by 13.0 release

@mkuznyetsov mkuznyetsov modified the milestones: 7.12, 7.13 Apr 29, 2020
@nickboldt nickboldt modified the milestones: 7.13, 7.14 May 26, 2020
@nickboldt
Copy link
Contributor Author

Slip turning on the automated release to MC to the 7.14 release.

@nickboldt
Copy link
Contributor Author

From Mykhailo:

After each rework of the script flow, to avoid committing bad artifacts to nexus
even though I know how to do a respin in that case
it feels like it takes more time to trigger and wait for the whole respin, than to go on nexus, verify and push 2 buttons
Like, I'd personally prefer to not do it AGAIN for 7.15, since I'll release parent again, and there will be some changes related to version bumping again

So we slip to 7.16.

@mkuznyetsov mkuznyetsov mentioned this issue Aug 26, 2020
12 tasks
@mkuznyetsov mkuznyetsov mentioned this issue Sep 2, 2020
13 tasks
This was referenced Sep 9, 2020
@mkuznyetsov mkuznyetsov modified the milestones: 7.16, 7.19 Sep 17, 2020
@mkuznyetsov
Copy link
Contributor

Autorelease on nexus is being used by default now

This was referenced Sep 25, 2020
@mkuznyetsov mkuznyetsov mentioned this issue Oct 6, 2020
13 tasks
This was referenced Oct 22, 2020
This was referenced Nov 5, 2020
@nickboldt nickboldt mentioned this issue Nov 18, 2020
14 tasks
@mkuznyetsov mkuznyetsov mentioned this issue Nov 26, 2020
13 tasks
This was referenced Dec 2, 2020
@nickboldt nickboldt mentioned this issue Dec 10, 2020
13 tasks
@mkuznyetsov mkuznyetsov mentioned this issue Dec 23, 2020
12 tasks
@nickboldt nickboldt mentioned this issue Jan 5, 2021
13 tasks
This was referenced Jan 11, 2021
@nickboldt nickboldt mentioned this issue Jan 19, 2021
16 tasks
@mkuznyetsov mkuznyetsov mentioned this issue Jan 27, 2021
13 tasks
This was referenced Jan 29, 2021
This was referenced Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci CI build and releases, PR testing, & whitelabel/productization issues kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

No branches or pull requests

4 participants