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

chore(deps): update quay.io/keycloak/keycloak docker tag to v26 #349

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions .bin/start-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { fileURLToPath } from 'node:url'
import { promisify } from 'node:util'
import tar from 'tar-fs'

// renovate: datasource=docker depName=quay.io/keycloak/keycloak
const KEYCLOAK_VERSION = '25.0.6';
const DIR_NAME = path.dirname(fileURLToPath(import.meta.url))
const SERVER_DIR = path.resolve(DIR_NAME, '../tmp/server')
const SCRIPT_EXTENSION = process.platform === 'win32' ? '.bat' : '.sh'
Expand All @@ -26,16 +24,16 @@ await startServer()
async function startServer () {
await downloadServer()

console.info('Starting server…')
console.info('Starting server …')

const args = process.argv.slice(2)
const child = spawn(
path.join(SERVER_DIR, `bin/kc${SCRIPT_EXTENSION}`),
['start-dev', ...args],
{
env: {
KEYCLOAK_ADMIN: 'admin',
KEYCLOAK_ADMIN_PASSWORD: 'admin',
KC_BOOTSTRAP_ADMIN_USERNAME: 'master-admin',
KC_BOOTSTRAP_ADMIN_PASSWORD: 'admin',
...process.env
}
}
Expand All @@ -46,7 +44,7 @@ async function startServer () {
}

async function downloadServer () {
const directoryExists = fs.existsSync(SERVER_DIR)
const directoryExists = fs.existsSync(path.join(SERVER_DIR, `bin/kc${SCRIPT_EXTENSION}`))

if (directoryExists) {
console.info('Server installation found, skipping download.')
Expand All @@ -55,22 +53,28 @@ async function downloadServer () {

console.info('Downloading and extracting server…')

const asset = await getAsset()
const assetStream = await getAssetAsStream(asset)
const nightlyAsset = await getNightlyAsset()
//console.log(nightlyAsset)
const assetStream = await getAssetAsStream(nightlyAsset)

await extractTarball(assetStream, SERVER_DIR, { strip: 1 })
}

async function getAsset () {
async function getNightlyAsset () {
const api = new Octokit()
const tag = process.env.kcVersion || 'nightly';
const release = await api.repos.getReleaseByTag({
owner: 'keycloak',
repo: 'keycloak',
tag: KEYCLOAK_VERSION
tag: tag
})
let assertName = `keycloak-${tag}.tar.gz`
if (tag == 'nightly') {
assertName = 'keycloak-999.0.0-SNAPSHOT.tar.gz'
}

return release.data.assets.find(
({ name }) => name === `keycloak-${KEYCLOAK_VERSION}.tar.gz`
({ name }) => name === assertName
)
}

Expand All @@ -86,4 +90,4 @@ async function getAssetAsStream (asset) {

function extractTarball (stream, path, options) {
return pipelineAsync(stream, gunzip(), tar.extract(path, options))
}
}
Loading
Loading