Add ability to deploy js adapter to maven repository. - #23425
Conversation
As mentioned under #23428 (comment), why not use semantic versioning everywhere? This would work both in NPM and Maven. |
Passing run #9013 ↗︎Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
|||||||||||||||
The problem is that internal build system will change the version of artifacts. Then we are going to publish keycloak artifacts in public maven repository with the new version. |
That is still possible with semantic versioning, no? Could you elaborate on what makes those versions different than the ones we use for Keycloak upstream? |
|
Just discussed this with @pskopek and I believe we can create valid semantic versions for RHBK by using the following format |
Closes keycloak#23312 Signed-off-by: Peter Skopek <pskopek@redhat.com>
bddbc2f to
fc6fbdd
Compare
| #!/bin/bash -e | ||
|
|
||
| NEW_VERSION=$1 | ||
| NEW_NPM_VERSION=${2:-${1}} |
There was a problem hiding this comment.
I still think we should not be using a seperate version for NPM. Instead the input versions should all adhere to valid semantic versions.
There was a problem hiding this comment.
This line has nothing to do with using valid semantic versions. It allows our downstream build script to override the NPM version if needed (mainly for debug/investigation purpose).
Even if one uses set-version.sh with one parameter and specifies "non-semantic" version it will use it anyway (no validation of version is present).
Our production build script is using "./set-version.sh use_current".
There was a problem hiding this comment.
Why would it need to do that? Wouldn't you just override all the versions?
There was a problem hiding this comment.
The internal build system assigns version to keycloak (and aligns dependencies) before start of maven build.
We have to use what was assigned. The problem is that assigned version is Maven compatible, but not npm compatible.
Therefore we need two of them. See my comment in set-version.sh script.
There was a problem hiding this comment.
Therefore we need two of them. See my comment in set-version.sh script.
Or the version can be a valid semantic version, in which case it would work for both.
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.ui.account2.DeviceActivityTest#timeLocaleTestKeycloak CI - Account Console IT (firefox) org.keycloak.testsuite.javascript.JavascriptAdapterTest#testSilentCheckSso |
ghost
left a comment
There was a problem hiding this comment.
Unreported flaky test detected, please review
ghost
left a comment
There was a problem hiding this comment.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.ui.account2.WelcomeScreenTest#accountSecurityTestKeycloak CI - Account Console IT (firefox) |
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| <profiles> |
There was a problem hiding this comment.
This looks unnecessarily complex, and adds some custom Maven registry settings just for this module. Why not just attach the tgz with:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>${project.basedir}/assembly.xml
<file>target/keycloak-js-${project.version}.tgz</file>
<type>tar.gz</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
and change the configuration for maven-deploy-plugin to `true. That way it's just uploaded along the other artifacts.
There was a problem hiding this comment.
I can certainly do this. I just didn't want to alter original maven build behavior.
| if [ $NEW_VERSION == 'use_current' ] ; then | ||
| # obtain NEW_VERSION from maven pom file | ||
| # - useful for downstream projects which already set the version in pom files | ||
| NEW_VERSION=$(./get-version.sh) | ||
| NEW_NPM_VERSION=$(echo $NEW_VERSION | awk -F '.' '{ print $1"."$2"."$3"+"$4 }') | ||
| else |
There was a problem hiding this comment.
What's the purpose of this?
There was a problem hiding this comment.
Follow up from #23425 (comment).
This will assign NPM compatible version string. The third dot is changed to '+' as suggested by @jonkoops .
stianst
left a comment
There was a problem hiding this comment.
I'm not really following the need to have different versions for NPMs, and changes to the set-version script. Both Maven and NPM require a semantic version, and isn't the versions used by PNC/RH stuff already semantic compatible and can be used as is?
RH version is not semantic compatible. https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions |
Then let's change the version so it works for both, no? What is preventing us from doing that? |
We cannot change the suffix generated by internal build system. There are so many other parts that use the knowledge of this format. |
|
If we need this for the release of 22, I suggest we only land this patch for the release branch. I'd rather not have this code end up in
Why is this not possible exactly? |
|
There's nothing we can do about the versions used downstream, which is a shame since they are not even semver compatible. I've created a simpler proposal (at least IMO) for this here: #23512 |
|
an easier way to have keycloak-js in maven central is by using <dependency>
<groupId>org.mvnpm</groupId>
<artifactId>keycloak-js</artifactId>
<version>22.0.3</version>
<scope>runtime</scope>
</dependency> |
|
Closing in favor of back port of this PR #23512 |
Closes #23312
This change will allow any downstream build to deploy keycloak-js-adapter tgz archive to maven repository by setting following properties:
Change is set-version.sh script allows to use different version string for node package (as version string in maven and npm are not compatible).