Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Automate building reports using Docker and SDKMAN #9

Closed
wants to merge 8 commits into from
Closed

Automate building reports using Docker and SDKMAN #9

wants to merge 8 commits into from

Conversation

pivovarit
Copy link
Contributor

@pivovarit pivovarit commented Nov 29, 2019

The process of setting up the environment for the sake of generating a report was in my case a bit tedious so I automated and encapsulated all of that in a single Dockerfile - making it possible to generate reports without downloading multiple JDKs and messing up with Maven's toolchains.xml.

Parameter names (especially JDKs) remained unchanged and might seem just wrong (just as the JDK version of the builder) - wanted to make the change minimally invasive so I adapted to the existing shape of the codebase.

At the end of the build, the jdk-api-diff.html spawns in a directory from which the command was called.


In order to build an example report between SDKMAN distributions tagged 11.0.5-open and 12.0.2-open, run:

./compare.sh 11.0.5-open 12.0.2-open

which becomes effectively:

docker build --build-arg JDK1=11.0.5-open --build-arg JDK2=12.0.2-open -t jdk-api-diff .
docker run --rm --entrypoint cat jdk-api-diff target/jdk-api-diff.html > ./jdk-api-diff.html

If you don't know what available distributions are, run the script without providing build-args:

./compare.sh

or just:

docker build -t jdk-api-diff .

Depends on: #8

@pivovarit pivovarit marked this pull request as ready for review November 29, 2019 07:18
@pivovarit pivovarit changed the title Automate comparisons using Docker and SDKMAN Automate building reports using Docker and SDKMAN Nov 29, 2019
@karianna karianna added the enhancement New feature or request label Nov 29, 2019
@karianna karianna added this to In progress in jdk-api-diff via automation Nov 29, 2019
Copy link
Collaborator

@gunnarmorling gunnarmorling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, @pivovarit! Some comments inline.


RUN echo '<?xml version="1.0" encoding="UTF-8"?>' > /usr/share/maven/conf/toolchains.xml
RUN echo '<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">' >> /usr/share/maven/conf/toolchains.xml
RUN echo "<toolchain><type>jdk</type><provides><version>10</version><vendor>openjdk</vendor></provides><configuration><jdkHome>$HOME/.sdkman/candidates/java/$JDK1</jdkHome></configuration></toolchain>" >> /usr/share/maven/conf/toolchains.xml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the interaction with this toolchains.xml file intended to be? Shouldn't the versions (10, 11) be configurable?

Copy link
Contributor Author

@pivovarit pivovarit Nov 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, removed(#10) :) we could just feed two JAVA_HOMEs to Maven builds instead of configuring them via toolchains.xml

But here, I assumed that containers are throw-away so although the values there are hardcoded, the actual content gets substituted (and versions are resolved based on java -version and not on the toolchain entry name)

RUN curl -s http://get.sdkman.io | bash

ARG JDK1
RUN test -n "$JDK1" || (echo "JDK1 build-arg not provided - choose one from:" && bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk l java" && false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about getting the JDKs via a volume from the host? This would avoid the repeated download for building version-specific images. WDYT?

Copy link
Contributor Author

@pivovarit pivovarit Nov 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, my assumption was that if someone wants to just try it, that would be handy to have that fully automated.

If someone wants to pass volumes from the host, they can just simply run the code without using the Docker-based solution - but naturally, that could be added as well

The added value here is the fact that you don't need to configure much in order to get a report and is not supposed to replace the bare solution

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karianna
Copy link
Member

@gunnarmorling Should we proceed with this PR?

@pivovarit
Copy link
Contributor Author

After such a long time... it's probably not working anymore. But I'm willing to update it if needed.

@karianna karianna closed this Apr 4, 2024
jdk-api-diff automation moved this from In progress to Done Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
No open projects
jdk-api-diff
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants