Giter VIP home page Giter VIP logo

sdkman-db-migrations's Introduction

SDKMAN! Golang CLI

Build Status

This project has been downgraded to a mere spike, the learnings of which will lead to the next phase of exploration of the CLI. We are also looking at Rust as an alternative implementation solution.

The current bash implementation is still completely fit for purpose and remains in full production use.

Living Documentation

SDKMAN's development is always driven by tests. More than that, we use Cucumber to describe the behaviour of the CLI in plain English. We do so using Cucumber features, all of which can be found under the features/ folder of this repo. These Features form a body of Living Documentation that evolves with the software implementation.

The Cucumber Features are backed by Step Definitions, snippets of matched code that are invoked in order as the Cucumber Feature are

Development

Prerequisites

Ensure that Go is installed on your system.

Optionally, install Godog for running the Cucumber specifications directly:

$ go get github.com/DATA-DOG/godog/cmd/godog

Running the tests

To run all tests using Go's builtin test support (unit and cukes):

$ cd path/to/the/repo/sdk
$ go test --godog.format=pretty

If Godog was installed earlier, run the Cucumber specs directly in isolation with the following command:

$ godog

Run

To kick the tyres before building:

$ go run sdk.go version

Build

To build and run the binary executable:

$ go build
$ ./sdk

sdkman-db-migrations's People

Contributors

aalmiray avatar ahmadshalabi avatar andrebrait avatar chethanuk avatar eddumelendez avatar helpermethod avatar ilopmar avatar jandroav avatar jorsol avatar joschi avatar jreznot avatar lrlucena avatar manikmagar avatar marc0der avatar maxandersen avatar mdeinum avatar mykolagolubyev avatar opalo avatar philiplourandos avatar poad avatar rainboyan avatar rdmueller avatar ssadedin avatar stefanpenndorf avatar sualeh avatar timw avatar vpavic avatar wololock avatar xshyamx avatar zakkak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sdkman-db-migrations's Issues

Add "visible" field to "versions" collection with default value "true"

In order to allow soft-deletes a visible flag should be added to the versions collection.
If code in the sdkman/sdk-candidates project breaks due to the schema change, it should be fixed in a way to stay backwards-compatible (i.e. no visible change to the behaviour).

This is the first step in resolving #170.

Unable to install GraalVM CE 19.1.0 on macOS

Unable to install GraalVM CE 19.1.0 on macOS (Mojave 10.14.5)
Works well on Linux machine ...

sdk install java 19.1.0-grl
tr: Illegal byte sequence

Downloading: java 19.1.0-grl

In progress...

######################################################################## 100.0%

Repackaging Java 19.1.0-grl...
-bash: cd: /Users/rsvoboda/.sdkman/tmp/out/*/Contents: No such file or directory
mv: rename Home to /Users/rsvoboda/.sdkman/tmp/Java-19.1.0-grl: No such file or directory

zip error: Nothing to do! (try: zip -qyr /Users/rsvoboda/.sdkman/tmp/.zip . -i Java-19.1.0-grl)

Done repackaging...
Cleaning up residual files...
mv: rename /Users/rsvoboda/.sdkman/tmp/.zip to /Users/rsvoboda/.sdkman/archives/java-19.1.0-grl.zip: No such file or directory
unzip:  cannot find or open /Users/rsvoboda/.sdkman/archives/java-19.1.0-grl.zip, /Users/rsvoboda/.sdkman/archives/java-19.1.0-grl.zip.zip or /Users/rsvoboda/.sdkman/archives/java-19.1.0-grl.zip.ZIP.
rm: /Users/rsvoboda/.sdkman/archives/java-19.1.0-grl.zip: No such file or directory

Stop! The archive was corrupt and has been removed! Please try installing again.

Bug: [Invalid default candidate for Java]

Bug report

Cannot install a default java version

To reproduce

sdk i java
No update at this time. Using existing cache: ant,asciidoctorj,ballerina,bpipe,btrace,ceylon,concurnas,crash,cuba,cxf,doctoolchain,dotty,gaiden,glide,gradle,gradleprofiler,grails,groovy,groovyserv,http4k,infrastructor,java,jbake,jbang,karaf,kotlin,kscript,lazybones,leiningen,maven,micronaut,mulefd,mvnd,sbt,scala,spark,springboot,sshoogr,test,tomcat,vertx,visualvm
Not refreshing version cache now...
Validate java 11.0.8.hs-adpt for Darwin: invalid
Validation URL: https://api.sdkman.io/2/candidates/validate/java/11.0.8.hs-adpt/darwin

Stop! java 11.0.8.hs-adpt is not available. Possible causes:
 * 11.0.8.hs-adpt is an invalid version
 * java binaries are incompatible with Darwin
 * java has not been released yet

The SDK API call is returning a wrong version:

curl https://api.sdkman.io/2/candidates/default/java
11.0.8.hs-adpt%                                                                                                                  

The expected version should be

11.0.9.hs-adpt

System info

OS:

Darwin 157278S0 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64

Shell

zsh --version
zsh 5.7.1 (x86_64-apple-darwin19.0)

SDK version

sdk version
SDKMAN 5.9.1+575

Please change AdoptOpenJDK openj9 to 64bit on Windows

"https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09_openj9-0.20.0/OpenJDK8U-jdk_x86-32_windows_openj9_8u252b09_openj9-0.20.0.zip",

I find on Windows use

sdk i java 8.0.252.j9-adpt

Will get 32bit version instead of 64bit.

$ curl -sI https://api.sdkman.io/2/broker/download/java/8.0.252.j9-adpt/mingw64_nt-10.0-19041
HTTP/1.1 302 Found
Server: nginx/1.15.12
Date: Wed, 01 Jul 2020 15:18:27 GMT
Content-Length: 0
Connection: keep-alive
location: https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09_openj9-0.20.0/OpenJDK8U-jdk_x86-32_windows_openj9_8u252b09_openj9-0.20.0.zip

You can see the download URL redirect to 32bit version

"./gradlew clean run" fails with exception due to changeset 47 and 52

[main] ERROR io.sdkman.changelogs.package$$anon$1 - URL https://download.java.net/java/GA/jdk11/28/GPL/openjdk-11+28_linux-x64_bin.tar.gz responded with text/html content-type detected
[main] INFO com.github.mongobee.Mongobee - Mongobee is releasing process lock.
Exception in thread "main" com.github.mongobee.exception.MongobeeException: Invalid url: https://download.java.net/java/GA/jdk11/28/GPL/openjdk-11+28_linux-x64_bin.tar.gz
        at com.github.mongobee.Mongobee.executeMigration(Mongobee.java:200)
        at com.github.mongobee.Mongobee.execute(Mongobee.java:156)
        at io.sdkman.DbMigration$.delayedEndpoint$io$sdkman$DbMigration$1(DbMigration.scala:10)
        at io.sdkman.DbMigration$delayedInit$body.apply(DbMigration.scala:5)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:389)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at io.sdkman.DbMigration$.main(DbMigration.scala:5)
        at io.sdkman.DbMigration.main(DbMigration.scala)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.github.mongobee.Mongobee.executeChangeSetMethod(Mongobee.java:235)
        at com.github.mongobee.Mongobee.executeMigration(Mongobee.java:181)
        ... 12 more
Caused by: com.github.mongobee.exception.MongobeeChangeSetException: Invalid url: https://download.java.net/java/GA/jdk11/28/GPL/openjdk-11+28_linux-x64_bin.tar.gz
        at io.sdkman.changelogs.package$$anon$1.checkResourceAvailable(package.scala:45)
        at io.sdkman.changelogs.package$$anon$1.validUrl(package.scala:36)
        at io.sdkman.changelogs.package$$anon$1.validUrl(package.scala:26)
        at io.sdkman.changelogs.package$$anon$4.$anonfun$validUrl$1(package.scala:52)
        at io.sdkman.changelogs.package$$anon$4.$anonfun$validUrl$1$adapted(package.scala:52)
        at scala.collection.immutable.List.foreach(List.scala:389)
        at io.sdkman.changelogs.package$$anon$4.validUrl(package.scala:52)
        at io.sdkman.changelogs.package$$anon$4.validUrl(package.scala:49)
        at io.sdkman.changelogs.package$ValidationOps.validate(package.scala:84)
        at io.sdkman.changelogs.JavaMigrations.migrate047(JavaMigrations.scala:107)
        ... 18 more


FAILURE: Build failed with an exception.

GraalVM 19.3.0 with JDK 8 and JDK 11

The GraalVM team just released GraalVM CE 19.3.0. Things are getting more complicated - it now delivers two different versions, one based on JDK 8, and one based on JDK 11. How should we name the tag to support both versions? I was thinking about something like:

  • 19.3.0-jdk8-grl
  • 19.3.0-jdk11-grl

But the second one is 16 characters long, and as far as I remember we are limited to 15 :(

Do you have any ideas how to solve this problem?

Download is failing, why?

I'm trying to figure out, why a download is failing. In my case, it's about the installation of "java 16-sapmchn".

โžœ  BitBook git:(main) sdk install java 16-sapmchn

Downloading: java 16-sapmchn

In progress...

###################################################################################################################################### 100.0%
Download has failed, aborting!

Can not install java 16-sapmchn at this time...

I haven't found a debug mode in SDKMAN!, so I tried to understand this repository to find the corresponding download url. I've found SapMachineMigrations.scala, but I don't get it: there is no entry for "16-sapmchn". So where is it declared?

Bug: Azul 16.0.1 on java/darwinarm64 is stale. Needs update to build 30+19 for macOS 11.4

Bug report

The java 16.0.1-zulu version installed on Mac arm fails to start on Mac 11.4

I can't tell from your docs who is responsible for updating your files. Is Azul is managing their release, or do you have a data side? Sorry if this is the wrong target. I've let them know too.

Caused by https://bugs.openjdk.java.net/browse/JDK-8267235 upstream.

To reproduce

  • sdk install java 16.0.1-zulu
  • javac -version

System info

Mac on 11.4
/tmp % uname -a 15:54:28
Darwin mb-m1 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:31 PDT 2021; root:xnu-7195.121.3
9/RELEASE_ARM64_T8101 arm64
~/tmp % sdk version 15:54:31
SDKMAN 5.11.4+709
~/tmp % zsh --version 15:54:44
zsh 5.8 (x86_64-apple-darwin20.0)

Bug: (At least) Leiningen "lesser" version considered higher than current version (2.9.4 < 2.9.3-1) on upgrade

Bug report

Having the most recent version (2.9.4) of leiningen installed, the sdk ug script suggests "upgrading" to 2.9.3-1.

To reproduce

Installation of most current leiningen version present:

# sdk ls leiningen
================================================================================
Available Leiningen Versions
================================================================================
 > * 2.9.4                                                                      
     2.9.3-1                                                                    
     2.9.3                                                                      
     2.9.2                                                                      
     2.9.1                                                                      
     2.9.0                                                                      
     2.7.1                                                                      
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================

Attempting to upgrade:

# sdk ug leiningen

Upgrade:
leiningen (2.9.4 < 2.9.3-1)

Upgrade candidate(s) and set latest version(s) as default? (Y/n): n

Expected: there is no need to update

Suspects

System info

  • uname -a: Linux $host 5.9.0-1-amd64 sdkman/sdkman-cli#1 SMP Debian 5.9.1-1 (2020-10-17) x86_64 GNU/Linux
  • cat /etc/debian_version: bullseye/sid
  • echo $SHELL: /usr/bin/zsh
  • zsh --version: zsh 5.8 (x86_64-debian-linux-gnu)
  • sdk version: SDKMAN 5.9.1+575

Add .sdkmanrc

Because I can never remember which Java version I need to use to build sdkman-db-migrations and because eating your own dogfood is healthy, I propose to add an .sdkmanrc with the appropriate java version.

New Java view doesn't show local versions

With the latest updates on improving candidates handling, the list view doesn't show local versions anymore, previously marked with "+". They are still usable but don't show up in the list.

Maybe it can be added at the end like another vendor?

================================================================================
Available Java Versions
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 ...
 java.net      |     | 14.ea.1      | open    |            | 14.ea.1-open        
               |     | 13.ea.25     | open    |            | 13.ea.25-open       
               |     | 12.0.1       | open    |            | 12.0.1-open         
               |     | 11.0.2       | open    |            | 11.0.2-open         
               |     | 10.0.2       | open    |            | 10.0.2-open         
               |     | 9.0.4        | open    |            | 9.0.4-open          
local          |     |              |         | installed  | <name-you-used>
               |     |              |         | installed  | <name-you-used>

Add support for older Scala versions

Hi all!

Right now, SDKMAN! supports Scala SDK versions starting from 2.11.0. Since there are a lot of projects out there that are still using older versions, is that possible to add support for 2.10.X?

I think that should be enough, since the latest 2.9.X version (2.9.3) has been tagged in 2013, so it's pretty old.

GraalVM 19.0.0 - what version tag should we use to avoid confusing SDKMAN users?

Just a while ago, the first stable release of GraalVM Community Edition was released - https://github.com/oracle/graal/releases/tag/vm-19.0.0 It is numbered with version 19.0.0, which is quite confusing compared to the release candidates versioning schema. Another interesting fact is that it adds an early adopter windows support.

I open this ticket to ask you - what version tag for GraalVM CE 19.0.0 should we use? It sounds like it should be

19.0.0-graalvm

or maybe

19.0.0-graal-ce

to indicate that this is a community edition. However, this might be confusing - does it mean it runs on Java 19? (It uses Java 8u212.) All other Java candidates shipped with SDKMAN use the postfix version to inform the user what is the underlying Java version. GraalVM breaks this convention.

It could be also introduced as a separate candidate, for instance sdk install graalvm 19.0.0, but it would interfere with java candidate. I could live with the fact that executing

$ sdk use graalvm 19.0.0

changes my $JAVA_HOME to the GraalVM candidate, overriding whatever sdk use java ... I did before the previous command.

Just wanted to ask for your opinion before creating the pull request with the update. /cc @marc0der @ilopmar

Amazon Corretto 11.0.2 (GA)

Amazon has release Corretto 11.0.2 (GA):
https://aws.amazon.com/about-aws/whats-new/2019/03/amazon-corretto-11-is-now-generally-available/

Due to the current naming scheme, I'm not sure how to add it to SDKMan, though.
The complete version specifier is "11.0.2.9.3" for the GA version and was "11.0.2.9.1" before. Unfortunately, SDKMan only covered the first 3 elements ("11.0.2"):

@ChangeSet(order = "092", id = "092-add_corretto_11.0.2", author = "joschi")
def migrate092(implicit db: MongoDatabase) = {
List(
Version("java", "11.0.2-amzn", "https://d2jnoze5tfhthg.cloudfront.net/amazon-corretto-11.0.2.9.1-linux-x64.tar.gz", Linux64),
Version("java", "11.0.2-amzn", "https://d2jnoze5tfhthg.cloudfront.net/amazon-corretto-11.0.2.9.1-windows-x64.zip", Windows),
Version("java", "11.0.2-amzn", "https://d2jnoze5tfhthg.cloudfront.net/amazon-corretto-11.0.2.9.1-macosx-x64.tar.gz", MacOSX)
).validate().insert()
}

Any ideas?

Download URLs:
https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html

Maintain older versions

It would be great if there was a way to get access to older versions (such that when coordinating a team to all use a specific JDK for example, using sdkman for installation, it makes it tough when old versions are no longer available). So, each time a new team member joins and/or a new laptop is used, we have to use the latest JDK available (of whatever flavor we are using), and if we all want to be on the same version everyone needs to upgrade.

Bug: Sap Machine OpenJDK fails to install

Bug report

None of the Sap Machine OpenJDK distros appear to be installable.

To reproduce

%sdk i java 16-sapmchn
Downloading: java 16-sapmchn

In progress...

####################################################################################################################################################################################################################### 100.0%
Download has failed, aborting!

Can not install java 16-sapmchn at this time...

%sdk i java 15.0.2-sapmchn
Downloading: java 15.0.2-sapmchn

In progress...

####################################################################################################################################################################################################################### 100.0%
Download has failed, aborting!

Can not install java 15.0.2-sapmchn at this time...

%sdk i java 11.0.10-sapmchn
Downloading: java 11.0.10-sapmchn

In progress...

####################################################################################################################################################################################################################### 100.0%
Download has failed, aborting!

Can not install java 11.0.10-sapmchn at this time...

System info

%uname -rsv
Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64

%echo $SHELL
/bin/zsh

%/bin/zsh --version
zsh 5.8 (x86_64-apple-darwin20.0)

%sdk version
SDKMAN 5.11.0+644

%sha256sum .sdkman/tmp/java-16-sapmchn.bin
d0d073685f15ed76eba35b54d0097ab11c9252aad59d2fc9fa52d347440bfc4a  .sdkman/tmp/java-16-sapmchn.bin

%wget -q https://github.com/SAP/SapMachine/releases/download/sapmachine-16/sapmachine-jdk-16_osx-x64_bin.dmg && sha256sum sapmachine-jdk-16_osx-x64_bin.dmg
d0d073685f15ed76eba35b54d0097ab11c9252aad59d2fc9fa52d347440bfc4a  sapmachine-jdk-16_osx-x64_bin.dmg

%sha256sum .sdkman/tmp/java-15.0.2-sapmchn.bin
35fd651595cac2588de08a943e8bb61ee2dd10146f4b459511ae577e9c3fa42c  .sdkman/tmp/java-15.0.2-sapmchn.bin

%wget -q https://github.com/SAP/SapMachine/releases/download/sapmachine-15.0.2/sapmachine-jdk-15.0.2_osx-x64_bin.dmg && sha256sum sapmachine-jdk-15.0.2_osx-x64_bin.dmg
35fd651595cac2588de08a943e8bb61ee2dd10146f4b459511ae577e9c3fa42c  sapmachine-jdk-15.0.2_osx-x64_bin.dmg

%sha256sum .sdkman/tmp/java-11.0.10-sapmchn.bin 
9534d6ec89f1dd77615f20f0d3bff7dd4d3f76ba2a4fe2e29431485cd9131dbe  .sdkman/tmp/java-11.0.10-sapmchn.bin

%wget -q https://github.com/SAP/SapMachine/releases/download/sapmachine-11.0.10/sapmachine-jdk-11.0.10_osx-x64_bin.dmg && sha256sum sapmachine-jdk-11.0.10_osx-x64_bin.dmg
9534d6ec89f1dd77615f20f0d3bff7dd4d3f76ba2a4fe2e29431485cd9131dbe  sapmachine-jdk-11.0.10_osx-x64_bin.dmg

Fix broken ZuluFX versions

Due to a copy-paste error,

  • Version 14.0.2 of ZuluFX does not exist
  • Version 13.0.4 of ZuluFX points to a 14.0.2 binary

image

Add parameters to Spark candidates

Some pre-built Spark releases are built with support for different versions of Scala and/or Hadoop.

For example, there are 4 different Spark 2.4.4 pre-built releases:

File name Scala Hadoop
spark-2.4.4-bin-without-hadoop.tgz 2.11 None
spark-2.4.4-bin-hadoop2.6.tgz 2.11 2.6
spark-2.4.4-bin-hadoop2.7.tgz 2.11 2.7+
spark-2.4.4-bin-without-hadoop-scala-2.12.tgz 2.12 None

It would be nice if sdkman knew about these options.

Add support for getting Java version series

In order to hide older versions of a version series (e.g. all Java 11, Java 8, Java 9 versions) a new method should be provided which, when given

  • a platform
  • a majorVersion (e.g. 11)
  • a vendorSuffix (e.g. zulu-fx, zulu)

returns a list of previous versions, which can then be hidden.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.