Skip to content

Commit

Permalink
Merge pull request #1026 from adoptium/main
Browse files Browse the repository at this point in the history
merge main into prod
  • Loading branch information
gdams authored Apr 29, 2024
2 parents 5732f85 + 5433dcf commit 76ed61e
Show file tree
Hide file tree
Showing 19 changed files with 232 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .github/actions/azure-login/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ runs:
using: composite
steps:
- name: Login to our Azure subscription.
uses: azure/login@8c334a195cbb38e46038007b304988d888bf676a # v2.0.0
uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0
with:
client-id: ${{ inputs.AZURE_CLIENT_ID_OIDC }}
tenant-id: ${{ inputs.AZURE_TENANT_ID }}
subscription-id: ${{ inputs.AZURE_SUBSCRIPTION_ID }}

- name: Login to Azure Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: adoptopenjdkacr.azurecr.io
username: ${{ inputs.AZURE_CLIENT_ID }}
password: ${{ inputs.AZURE_CLIENT_SECRET }}

- name: Set the target Azure Kubernetes Service (AKS) cluster.
uses: azure/aks-set-context@4edaee69f820359371ee8bc85189ac03a21d3a58 # v3.2
uses: azure/aks-set-context@37037e33d3a2fc08abe40c887d81c3f6e1eb93b9 # v4.0.0
with:
resource-group: adopt-api
cluster-name: aksff92
2 changes: 1 addition & 1 deletion .github/actions/docker-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
using: composite
steps:
- name: Build container image and push to Azure
uses: docker/build-push-action@af5a7ed5ba88268d5278f7203fb52cd833f66d6e # v5.2.0
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
file: ${{ inputs.DOCKER_FILE }}
tags: ${{ inputs.DOCKER_REPO }}:latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
adoptopenjdk) echo "ARGS=-Padoptopenjdk,-adoptium" >> $GITHUB_ENV ;;
esac
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
persist-credentials: false

- uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '21'
distribution: 'temurin'
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
name: "CodeQL"

on:
push:
branches: [ "main", "production" ]
pull_request:
branches: [ "main", "production" ]
schedule:
- cron: '26 5 * * 0'

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
include:
- language: java-kotlin
build-mode: manual
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'

- if: matrix.build-mode == 'manual'
run: |
./mvnw --batch-mode clean -Dmaven.test.skip=true install -Padoptium,-adoptopenjdk
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/deploy-adoptium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
if: startsWith(github.repository, 'adoptium/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Login to Azure
uses: ./.github/actions/azure-login
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-adoptopenjdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
if: startsWith(github.repository, 'adoptium/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Login to Azure
uses: ./.github/actions/azure-login
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
contents: write # for Git to git push

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '21'
distribution: 'temurin'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ open class MongoClient {
.applyConnectionString(ConnectionString(connectionString))
val sslEnabled = System.getenv("MONGODB_SSL")?.toBoolean()
if (sslEnabled == true) {
settingsBuilder = settingsBuilder.applyToSslSettings { it.enabled(true).invalidHostNameAllowed(true) }
val checkMongoHostName = System.getenv("DISABLE_MONGO_HOST_CHECK")?.toBoolean() ?: true

settingsBuilder = settingsBuilder.applyToSslSettings { it.enabled(true).invalidHostNameAllowed(checkMongoHostName) }
}
client = KMongo.createClient(settingsBuilder.build()).coroutine
database = client.getDatabase(dbName)
Expand Down
30 changes: 15 additions & 15 deletions adoptium-api-versions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@

<properties>
<coroutine.version>1.8.0</coroutine.version>
<jackson.version>2.16.2</jackson.version>
<jackson.version>2.17.0</jackson.version>
<jdk.version>17</jdk.version>
<kmongo.version>4.11.0</kmongo.version>
<kotlin.compiler.jvmTarget>17</kotlin.compiler.jvmTarget>
<kotlin.version>1.9.23</kotlin.version>
<logback.version>1.5.3</logback.version>
<logback.version>1.5.6</logback.version>
<maven.compiler.release>17</maven.compiler.release>
<maven.version>3.9.6</maven.version>
<maven.project-info-reports-plugin.version>3.5.0</maven.project-info-reports-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>3.8.2</quarkus.version>
<quarkus.version>3.9.4</quarkus.version>
<rest-assured.version>5.4.0</rest-assured.version>
</properties>

Expand Down Expand Up @@ -200,7 +200,7 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>4.12.2</version>
<version>4.12.6</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -232,7 +232,7 @@
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.2.0</version>
<version>4.2.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -247,12 +247,12 @@
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>3.19.6</version>
<version>3.19.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.12</version>
<version>2.0.13</version>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
Expand All @@ -263,22 +263,22 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-runtime-attach</artifactId>
<version>3.5.0</version>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>io.opentelemetry.javaagent.instrumentation</groupId>
<artifactId>opentelemetry-javaagent-kotlinx-coroutines</artifactId>
<version>2.1.0-alpha</version>
<version>2.3.0-alpha</version>
</dependency>
<dependency>
<groupId>io.opentelemetry.javaagent.instrumentation</groupId>
<artifactId>opentelemetry-javaagent-netty-4.1</artifactId>
<version>2.1.0-alpha</version>
<version>2.3.0-alpha</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-junit5</artifactId>
<version>4.0.2.Final</version>
<version>4.0.3.Final</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -355,13 +355,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>12.0.7</version>
<version>12.0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>12.0.7</version>
<version>12.0.8</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
Expand All @@ -386,7 +386,7 @@
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
Expand All @@ -401,7 +401,7 @@
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>4.0.1</version>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>net.adoptium.api</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.Produces
import jakarta.ws.rs.core.MediaType
import jakarta.ws.rs.core.Response
import jakarta.ws.rs.core.UriInfo

@Tag(name = "Release Info")
@Path("/v3/info")
Expand All @@ -20,6 +22,7 @@ class AvailableReleasesResource
constructor(
private val apiDataStore: APIDataStore
) {

@GET
@Path("/available_releases")
@Operation(summary = "Returns information about available releases", operationId = "getAvailableReleases")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.adoptium.api.v3.routes.info

import jakarta.enterprise.context.ApplicationScoped
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.Produces
import jakarta.ws.rs.core.MediaType
import net.adoptium.api.v3.models.Architecture
import org.eclipse.microprofile.openapi.annotations.Operation
import org.eclipse.microprofile.openapi.annotations.tags.Tag

@Tag(name = "Types")
@Path("/v3/types")
@Produces(MediaType.APPLICATION_JSON)
@ApplicationScoped
class TypesArchitecturesResource {

@GET
@Path("/architectures")
@Operation(summary = "Returns names of architectures", operationId = "getArchitectures")
fun get(): List<String> {
return Architecture.values().map { it.name }.toList()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.adoptium.api.v3.routes.info

import jakarta.enterprise.context.ApplicationScoped
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.Produces
import jakarta.ws.rs.core.MediaType
import net.adoptium.api.v3.models.OperatingSystem
import org.eclipse.microprofile.openapi.annotations.Operation
import org.eclipse.microprofile.openapi.annotations.tags.Tag

@Tag(name = "Types")
@Path("/v3/types")
@Produces(MediaType.APPLICATION_JSON)
@ApplicationScoped
class TypesOperatingSystemsResource {

@GET
@Path("/operating_systems")
@Operation(summary = "Returns names of operating systems", operationId = "getOperatingSystems")
fun get(): List<String> {
return OperatingSystem.values().map { it.name }.toList()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.adoptium.api

import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured
import io.restassured.config.RedirectConfig
import net.adoptium.api.v3.JsonMapper
import net.adoptium.api.v3.models.ReleaseInfo
import org.hamcrest.Description
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.adoptium.api

import io.restassured.RestAssured
import net.adoptium.api.v3.JsonMapper
import net.adoptium.api.v3.models.Architecture
import org.junit.jupiter.api.Test

class TypesArchitecturesPathTest : FrontendTest() {

@Test
fun getArchitectures() {
RestAssured.given()
.`when`()
.get("/v3/types/architectures")
.then()
.statusCode(200)
}

@Test
fun getArchitecturesAreCorrect() {
var body = RestAssured.given()
.`when`()
.get("/v3/types/architectures")
.body

val architectures = parseArchitectures(body.asString())

assert(architectures.contains(Architecture.x64.name))
assert(architectures.size == Architecture.values().size)
}

private fun parseArchitectures(json: String?): List<String> =
JsonMapper.mapper.readValue(json, JsonMapper.mapper.typeFactory.constructCollectionType(MutableList::class.java, String::class.java))
}
Loading

0 comments on commit 76ed61e

Please sign in to comment.