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

atempt to upgrade to jdk 17 #790

Closed
wants to merge 15 commits into from
25 changes: 19 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
job-build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# Disabling shallow clone is recommended for improving relevancy of reporting for sonar
fetch-depth: 0
Expand All @@ -32,12 +32,18 @@ jobs:
${{ runner.os }}-maven-
- name: Cache local Maven repository

- name: Set up JDK 11
uses: actions/setup-java@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

java-version: '17'


- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.3

# Ubuntu Repos on Azure fail often. Attempt to install before other
# long-running operations.
- name: Install xmllinter (for "Fail on failed tests")
Expand All @@ -52,6 +58,13 @@ jobs:
echo "::set-output name=version::$VERSION"
id: project_version

# - name: run cloverage
# working-directory: code
# run: |
# export JAVA_OPTS="-Xms6g -Xmx6g"
# export ES_JAVA_OPTS="-Xms6g -Xmx6g"
# lein cloverage --codecov

- name: Setup Sonar Scanner
uses: warchant/setup-sonar-scanner@v3
with:
Expand All @@ -65,7 +78,7 @@ jobs:
run: |
export JAVA_OPTS="-Xms6g -Xmx6g"
export ES_JAVA_OPTS="-Xms6g -Xmx6g"
sonar-scanner -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} -Dsonar.projectVersion=${{ steps.project_version.outputs.version }}
sonar-scanner --debug -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} -Dsonar.projectVersion=${{ steps.project_version.outputs.version }}

- name: Get list of tests
if: always()
Expand Down
95 changes: 49 additions & 46 deletions code/project.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(def parent-version "6.7.13")
(def nuvla-ring-version "2.0.9")
(def parent-version "6.7.12")
(def nuvla-ring-version "2.0.8")
(def kinsky-version "0.3.1")

(defproject sixsq.nuvla.server/api-jar "6.0.18-SNAPSHOT"
Expand All @@ -13,6 +13,7 @@
:distribution :repo}

:plugins [[lein-parent "0.3.9"]
[lein-cloverage "1.2.4"]
[lein-environ "1.2.0"]
[lein-project-version "0.1.0"]]

Expand All @@ -32,21 +33,22 @@
:dependencies
[[buddy/buddy-core]
[org.clojars.konstan/kinsky ~kinsky-version]
[metosin/jsonista "0.3.7"] ;; compilation error
[buddy/buddy-hashers]
[buddy/buddy-sign]
[cc.qbits/spandex :exclusions [org.clojure/clojure]]
[cc.qbits/spandex "0.7.11" :exclusions [org.clojure/clojure]]
[compojure]
[com.draines/postal]
[clj-http]
[clj-stacktrace]
[clojure.java-time]
[clojure.java-time "1.2.0"] ;;to be deleted
[com.amazonaws/aws-java-sdk-s3]
[duratom :exclusions [org.clojure/clojure]]
[expound]
[instaparse]
[metosin/spec-tools]
[org.bouncycastle/bcpkix-jdk15on "1.70"]
[selmer "1.12.50"]
[selmer "1.12.59"]
[org.clojure/data.json]
[org.clojure/java.classpath]
[org.clojure/tools.namespace]
Expand All @@ -63,12 +65,13 @@
[org.locationtech.jts/jts-core "1.18.2"]
;; need for Factual geo wkt polygon to geojson
;; upgrading jts2geojson dependency to 0.16 or 0.17 creates conflicts for now
[org.wololo/jts2geojson "0.15.0"]
[one-time "0.7.0"]]
[org.wololo/jts2geojson "0.15.0"
:exclusions [com.fasterxml.jackson.core/jackson-annotations]]
[one-time "0.8.0"]]

:profiles
{
:provided {:dependencies [[org.clojure/clojure]
:provided {:dependencies [[org.clojure/clojure "1.11.1"]
[sixsq.nuvla.ring/code ~nuvla-ring-version
; fix netty conflicts with elasticsearch test dependencies
:exclusions [io.netty/netty
Expand All @@ -83,50 +86,50 @@
io.netty/netty-transport-native-epoll]]
[org.clojars.konstan/kinsky-test-jar ~kinsky-version]]}

:test {:dependencies [[me.raynes/fs]
:test {:dependencies [[me.raynes/fs]
[peridot]
[org.apache.logging.log4j/log4j-core] ;; needed for ES logging
[org.apache.logging.log4j/log4j-api] ;; needed for ES logging
[org.clojure/test.check]
[org.elasticsearch.test/framework]
[org.elasticsearch.client/transport]
[org.codelibs.elasticsearch.module/lang-painless "7.0.0"]
[org.slf4j/slf4j-api]
[org.slf4j/slf4j-log4j12]
[com.cemerick/url]
[org.apache.curator/curator-test]
[org.clojars.konstan/kinsky-test-jar ~kinsky-version]]
:resource-paths ["test-resources"]
:env {:nuvla-session-key "test-resources/session.key"
:nuvla-session-crt "test-resources/session.crt"
:es-sniffer-init "no"
:kafka-producer-init "yes"}
:aot :all
:plugins [[org.clojars.konstan/lein-test-report-sonar "0.0.4"]]
:test-report-sonar {:output-dir "test-reports"
:emit-junit-xml true}}

:dev {:dependencies [[org.apache.zookeeper/zookeeper]
[clj-kondo "RELEASE"]
;; for running linters
[me.raynes/fs]
[peridot]
[org.apache.logging.log4j/log4j-core] ;; needed for ES logging
[org.apache.logging.log4j/log4j-api] ;; needed for ES logging
[org.clojure/test.check]
[org.apache.curator/curator-test]
[org.elasticsearch.test/framework]
[org.elasticsearch.client/transport]
[org.codelibs.elasticsearch.module/lang-painless "7.0.0"]
[org.slf4j/slf4j-api]
[org.slf4j/slf4j-log4j12]
[com.cemerick/url]
[org.apache.curator/curator-test]
[org.clojars.konstan/kinsky-test-jar ~kinsky-version]]
:resource-paths ["test-resources"]
:env {:nuvla-session-key "test-resources/session.key"
:nuvla-session-crt "test-resources/session.crt"
:es-sniffer-init "no"
:kafka-producer-init "yes"}
:aot :all
:plugins [[org.clojars.konstan/lein-test-report-sonar "0.0.4"]]
:test-report-sonar {:output-dir "test-reports"
:emit-junit-xml true}}

:dev {:dependencies [[org.apache.zookeeper/zookeeper]
[clj-kondo "RELEASE"]
;; for running linters
[me.raynes/fs]
[peridot]
[org.apache.curator/curator-test]
[org.elasticsearch.test/framework]
[org.elasticsearch.client/transport]
[org.codelibs.elasticsearch.module/lang-painless "7.0.0"]

[org.apache.logging.log4j/log4j-core]]
[org.apache.logging.log4j/log4j-core]]
;; paths
:source-paths ["src"]
:test-paths ["test"]
:resource-paths ["test-resources"]
:source-paths ["src"]
:test-paths ["test"]
:resource-paths ["test-resources"]
;; linters
:eastwood {:exclude-namespaces [sixsq.nuvla.server.resources.job.utils]}
:env {:nuvla-session-key "test-resources/session.key"
:nuvla-session-crt "test-resources/session.crt"
:es-sniffer-init "no"
:kafka-producer-init "no"}
:eastwood {:exclude-namespaces [sixsq.nuvla.server.resources.job.utils]}
:env {:nuvla-session-key "test-resources/session.key"
:nuvla-session-crt "test-resources/session.crt"
:es-sniffer-init "no"
:kafka-producer-init "no"}
;; code coverage
:cloverage {:ns-exclude-regex [#"sixsq.nuvla.pricing.protocol"]}
:cloverage {:ns-exclude-regex [#"sixsq.nuvla.pricing.protocol"]}
}})
14 changes: 7 additions & 7 deletions code/src/sixsq/nuvla/auth/utils/timestamp.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"Utilities for creating expiration times for token claims and for formatting
them correctly for the cookie 'expires' field."
(:require
[java-time :as t]
[java-time.api :as t]
[sixsq.nuvla.server.util.time :as time]))


(def default-ttl-minutes 10080) ;; 1 week
(def default-ttl-minutes 10080) ;; 1 week


(defn rfc822
"Returns a timestamp formatted in cookie date format (RFC822) from the
number of **seconds** since the epoch."
[seconds-since-epoch]
(t/with-clock
(t/system-clock "UTC")
time/utc-clock
(let [millis-since-epoch (* seconds-since-epoch 1000)
offset-date-time (-> millis-since-epoch
(t/instant)
Expand Down Expand Up @@ -44,8 +44,8 @@


(defn rfc822->iso8601
[rfc822]
(->> rfc822
(t/offset-date-time time/rfc822-formatter)
(t/format time/iso8601-formatter)))
[^String rfc822]
(-> rfc822
(time/parse-date-fmt time/rfc822-formatter)
time/to-str))

2 changes: 1 addition & 1 deletion code/src/sixsq/nuvla/db/es/filter.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@


(defmethod convert :DateValue [[_ ^String s]]
[:Value (time/date-from-str s)])
[:Value (time/parse-date s)])


(defmethod convert :NullValue [[_ ^String _]]
Expand Down
8 changes: 1 addition & 7 deletions code/src/sixsq/nuvla/server/resources/common/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@
;; resource ID utilities
;;

(defn random-uuid
"Provides the string representation of a pseudo-random UUID."
[]
(str (UUID/randomUUID)))


(defn from-data-uuid
"Provides the string representation of a UUID generated from an input."
[input]
Expand Down Expand Up @@ -190,7 +184,7 @@
"This will return true if the given date (as a string) represents a moment
of time in the past. Returns false otherwise."
[expiry]
(boolean (and expiry (time/before? (time/date-from-str expiry) (time/now)))))
(boolean (and expiry (time/before? (time/parse-date expiry) (time/now)))))


(def not-expired? (complement expired?))
Expand Down
7 changes: 3 additions & 4 deletions code/src/sixsq/nuvla/server/resources/email/sending.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
(:require
[clojure.java.io :as io]
[clojure.tools.logging :as log]
[java-time :as t]
[postal.core :as postal]
[selmer.parser :as tmpl]
[sixsq.nuvla.server.resources.common.crud :as crud]
[sixsq.nuvla.server.resources.configuration-nuvla :as config-nuvla]
[sixsq.nuvla.server.util.response :as r]))
[sixsq.nuvla.server.util.response :as r]
[sixsq.nuvla.server.util.time :as time]))

(def base-html (slurp (io/resource "sixsq/nuvla/html-template/base.html")))
(def trial-html (slurp (io/resource "sixsq/nuvla/html-template/trial.html")))
Expand Down Expand Up @@ -44,12 +44,11 @@

(defn render-content
[{:keys [template plain?] :as context-map}]
(println (t/java-date))
(tmpl/render
(case template
:trial (if plain? trial-txt trial-html)
base-html)
(assoc context-map :now (t/java-date))))
(assoc context-map :now (time/java-date (time/now)))))

(defn send-email
"send email to an email-address using a map from resources.email.text
Expand Down
2 changes: 1 addition & 1 deletion code/src/sixsq/nuvla/server/resources/spec/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

;; FIXME: Provide an implementation that works with ClojureScript.
(s/def ::timestamp
(-> (st/spec time/date-from-str)
(-> (st/spec time/parse-date)
(assoc :name "timestamp"
:json-schema/description "UTC timestamp"
:json-schema/type "date-time")))
Expand Down
4 changes: 2 additions & 2 deletions code/src/sixsq/nuvla/server/util/metadata.clj
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@
suffix (str "-" suffix))

common {:id "resource-metadata/dummy-id"
:created "1964-08-25T10:00:00.00Z"
:updated "1964-08-25T10:00:00.00Z"
:created "1964-08-25T10:00:00Z"
:updated "1964-08-25T10:00:00Z"
:resource-type resource-metadata/resource-type
:acl (acl-utils/normalize-acl {:owners ["group/nuvla-admin"]
:view-acl ["group/nuvla-anon"]})
Expand Down
Loading
Loading