Skip to content
Open
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
9 changes: 4 additions & 5 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/sh

# Prevent errors on shallow clones
if git rev-parse --verify HEAD@{1} >/dev/null 2>&1; then
npm run run-if-changed
else
echo "Skipping run-if-changed: Not enough Git history"
# Check if package-lock.json changed
if git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet 'package-lock.json'; then
echo "📦 package-lock.json changed, running npm install..."
npm install --prefer-offline --no-audit
fi
6 changes: 5 additions & 1 deletion .husky/post-merge
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/sh

npm run run-if-changed
# Check if package-lock.json changed
if git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet 'package-lock.json'; then
echo "📦 package-lock.json changed, running npm install..."
npm install --prefer-offline --no-audit
fi
6 changes: 5 additions & 1 deletion .husky/post-rewrite
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/sh

npm run run-if-changed
# Check if package-lock.json changed
if git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet 'package-lock.json'; then
echo "📦 package-lock.json changed, running npm install..."
npm install --prefer-offline --no-audit
fi
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22
v24
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --------------- Dev stage for developers to override sources
FROM node:22.21.1-alpine AS dev
FROM node:24-alpine AS dev

RUN apk --no-cache add make gcc g++ python3 git jq

Expand Down
7,393 changes: 3,970 additions & 3,423 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
"@linode/harbor-client-node": "^2.13.0",
"@linode/keycloak-client-node": "^26.1.5",
"async-retry": "^1.3.3",
"aws-sdk": "2.1692.0",
"axios": "1.13.2",
"bluebird": "3.7.2",
"dotenv": "^17.2.3",
"envalid": "8.1.1",
"generate-password": "^1.7.1",
"js-yaml": "4.1.0",
"lodash": "4.17.21",
"js-yaml": "4.1.1",
"lodash": "4.18.1",
"openid-client": "6.8.1",
"tsx": "^4.20.6"
},
Expand All @@ -35,7 +33,6 @@
"@eslint/compat": "^2.0.0",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.39.1",
"@hkdobrev/run-if-changed": "0.6.3",
"@types/async-retry": "1.4.9",
"@types/express": "5.0.5",
"@types/jest": "^30.0.0",
Expand All @@ -55,7 +52,7 @@
"globals": "^16.5.0",
"husky": "9.1.7",
"jest": "^30.2.0",
"jsonwebtoken": "9.0.2",
"jsonwebtoken": "9.0.3",
"lint-staged": "16.2.7",
"nock": "14.0.10",
"node-notifier": "10.0.1",
Expand All @@ -68,8 +65,8 @@
"typescript": "^5.9.3"
},
"engines": {
"node": ">=22.0.0",
"npm": "^10"
"node": ">=24.0.0",
"npm": "^11"
},
"homepage": "https://github.com/linode/apl-tasks#readme",
"license": "Apache-2.0",
Expand Down
37 changes: 4 additions & 33 deletions src/k8s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,29 @@ export const k8s = {
coreClient = k8s.kc().makeApiClient(CoreV1Api)
return coreClient
},
networking: (): NetworkingV1Api => {
if (networkingClient) return networkingClient
networkingClient = k8s.kc().makeApiClient(NetworkingV1Api)
return networkingClient
},
customObjectsApi: (): CustomObjectsApi => {
if (customObjectsApi) return customObjectsApi
customObjectsApi = kc.makeApiClient(CustomObjectsApi)
return customObjectsApi
},
}

export async function createSecret(
name: string,
namespace: string,
data: Record<string, any>,
secretType?: string,
): Promise<void> {
export async function createSecret(name: string, namespace: string, data: Record<string, any>): Promise<void> {
const b64enc = (val): string => Buffer.from(`${val}`).toString('base64')
const secret: V1Secret = {
metadata: { name },
data: mapValues(data, b64enc) as {
[key: string]: string
},
data: mapValues(data, b64enc),
}

await k8s.core().createNamespacedSecret({ namespace, body: secret })
console.info(`New secret ${name} has been created in the namespace ${namespace}`)
}

export async function replaceSecret(
name: string,
namespace: string,
data: Record<string, unknown>,
secretType?: string,
): Promise<void> {
export async function replaceSecret(name: string, namespace: string, data: Record<string, unknown>): Promise<void> {
const b64enc = (val): string => Buffer.from(`${val}`).toString('base64')
const secret: V1Secret = {
metadata: { name },
data: mapValues(data, b64enc) as {
[key: string]: string
},
data: mapValues(data, b64enc),
}

await k8s.core().replaceNamespacedSecret({
Expand All @@ -81,16 +62,6 @@ export async function replaceSecret(
console.info(`Secret ${name} has been patched in the namespace ${namespace}`)
}

export type SecretPromise = Promise<{
response: IncomingMessage
body: V1Secret
}>

export type ServiceAccountPromise = Promise<{
response: IncomingMessage
body: V1ServiceAccount
}>

export async function getSecret(name: string, namespace: string): Promise<unknown> {
const b64dec = (val): string => Buffer.from(val, 'base64').toString()
try {
Expand Down
2 changes: 1 addition & 1 deletion src/operators/gitea/lib/managers/gitea-repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function upsertRepo(
} else {
// repo update
console.info(`Updating repo "${repoName}" in organization "${orgName}"`)
await repoApi.repoEdit({ owner: orgName, repo: repoName, body: repoOption as EditRepoOption })
await repoApi.repoEdit({ owner: orgName, repo: repoName, body: repoOption })
if (teamName) {
console.info(`Checking if repo "${repoName}" is assigned to team "${teamName}"`)
try {
Expand Down
2 changes: 1 addition & 1 deletion src/operators/gitea/lib/managers/gitea-webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function createBuildWebHook(
webhookExists = webhooks.find((hook) => {
return (
hook.config!.url ===
`http://el-gitea-webhook-${buildWorkspace.buildName}.${teamName}.svc.cluster.local:8080` &&
`http://el-gitea-webhook-${buildWorkspace.buildName}.${teamName}.svc.cluster.local:8080` &&
hook.events?.includes('push')
)
})
Expand Down
2 changes: 1 addition & 1 deletion src/operators/keycloak/keycloak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ async function createKeycloakConnection(): Promise<KeycloakConnection> {

token = (await response.json()) as TokenEndpointResponse

return { token, basePath } as KeycloakConnection
return { token, basePath }
} catch (error) {
throw extractError('creating Keycloak connection', error)
}
Expand Down
8 changes: 4 additions & 4 deletions src/tasks/keycloak/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ProtocolMapperRepresentation } from '@linode/keycloak-client-node'
import axios from 'axios'
import { emailTransformer } from '../../utils'
import { cleanEnv, KEYCLOAK_CLIENT_ID } from '../../validators'

Expand Down Expand Up @@ -305,9 +304,10 @@ export const oidcCfg = (
})

export async function getDiscoveryUrls(oidcUrl: string, version = 'v2.0'): Promise<OidcProviderCfg> {
const response = await axios.get(`${oidcUrl}${version}/.well-known/openid-configuration`)
if (!response.data) throw Error('Oidc Provider Address not found!')
return response.data
const response = await fetch(`${oidcUrl}${version}/.well-known/openid-configuration`)
if (!response.ok) throw Error('Oidc Provider Address not found!')
const data = (await response.json()) as unknown
return data as OidcProviderCfg
}

export const idpProviderCfgTpl = async (
Expand Down
Loading