Compare commits

...

20 Commits

Author SHA1 Message Date
af0e2919f4 Move callbacks to the default switch blocks...
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 28m24s
2024-10-06 21:10:50 +02:00
beea84a6e9 Remove trailing spaces in link
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 28m7s
2024-10-06 20:38:14 +02:00
b6570b2385 use window instead of global for the RWJS_API_URL Variable
Some checks failed
build-docker-imge / Build the docker container (push) Has been cancelled
2024-10-06 20:13:15 +02:00
d514029e5a Move link-building to the server...
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 28m38s
2024-10-06 17:55:27 +02:00
086db87972 Adjust apiUrl
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 27m50s
2024-10-06 16:47:47 +02:00
e90bf240e8 Reset typescript version in yarn.lock
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 29m35s
2024-10-06 15:32:35 +02:00
3a56a6b892 Add crypto-js to required Modules
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 44s
2024-10-06 14:44:37 +02:00
6c176b3cdb Container-tags: add version, use diffrent names for web, api, and console
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 27m43s
2024-10-06 10:22:54 +02:00
b97c2f7fbc Container-tags: remove version
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 38m47s
2024-10-04 20:36:19 +02:00
13a5edc9ac Build each target container individually
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 8m29s
build-docker-imge / Build the docker container (pull_request) Failing after 8m7s
2024-10-04 19:55:55 +02:00
12e4b46761 Update .gitea/workflows/build-docker-container.yml
All checks were successful
build-docker-imge / Build the docker container (push) Successful in 10m39s
build-docker-imge / Build the docker container (pull_request) Successful in 10m39s
2024-10-04 17:33:08 +00:00
3d911448c4 push to the correct container registry 2024-10-04 17:33:08 +00:00
4f012b6b52 Fix pipeline 3 2024-10-04 17:33:08 +00:00
fd6ffabb89 Fix pipelines 2 2024-10-04 17:33:08 +00:00
02401550fc Fix pipeline builds. 2024-10-04 17:33:08 +00:00
9e8f21ff68 Fix: CI Pipeline 2024-10-04 17:33:08 +00:00
f793bc957b remove debug steps 2024-10-04 17:33:08 +00:00
db82158cc1 Debug Pipelines 2024-10-04 17:33:08 +00:00
14d846a456 Fix: Pipeline push permissions 2024-10-04 17:33:08 +00:00
af0d3d2c53 New: Automatic Docker container builds 2024-10-04 17:33:08 +00:00
12 changed files with 1080 additions and 22 deletions

View File

@ -0,0 +1,50 @@
name: build-docker-imge
on:
- push
jobs:
build:
name: Build the docker container
runs-on: ubuntu-latest
steps:
- name: "Git clone"
run: git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
- name: "LS"
run: ls -lisa
- name: "LS ECHO"
run: echo "$(ls)" "${{ gitea.repository }}" "${{ gitea.ref_name }}" "${{ gitea.sha }}"
- name: "Git checkout"
run: git checkout "${{ gitea.sha }}"
- uses: aevea/action-kaniko@master
name: Run Kaniko to build our api docker container.
with:
image: kocoded/nachhilfesystem/api
tag: ${{ git.workflow_sha }}
tag_with_latest: github.ref == 'refs/heads/master'
registry: git.kocoder.xyz
username: ${{ secrets.CI_RUNNER_USER }}
password: ${{ secrets.CI_RUNNER_TOKEN }}
build_file: Dockerfile
target: api_serve
- uses: aevea/action-kaniko@master
name: Run Kaniko to build our web docker container.
with:
image: kocoded/nachhilfesystem/web
tag: ${{ git.workflow_sha }}
tag_with_latest: github.ref == 'refs/heads/master'
registry: git.kocoder.xyz
username: ${{ secrets.CI_RUNNER_USER }}
password: ${{ secrets.CI_RUNNER_TOKEN }}
build_file: Dockerfile
target: web_serve
- uses: aevea/action-kaniko@master
name: Run Kaniko to build our console docker container.
with:
image: kocoded/nachhilfesystem/console
tag: ${{ git.workflow_sha }}
tag_with_latest: github.ref == 'refs/heads/master'
registry: git.kocoder.xyz
username: ${{ secrets.CI_RUNNER_USER }}
password: ${{ secrets.CI_RUNNER_TOKEN }}
build_file: Dockerfile
target: console

925
.yarn/releases/yarn-4.4.0.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,15 +1,9 @@
# Yarn's manifest file. You can configure yarn here.
# See https://yarnpkg.com/configuration/yarnrc.
# For `node_modules` (see `nodeLinker` below), this is almost always the preferred option.
compressionLevel: 0
enableGlobalCache: true
# Lets yarn use hardlinks inside `node_modules` to dedupe packages.
# For a more pnpm-like experience, consider `hardlinks-global` where hardlinks point to a global store.
nmMode: hardlinks-local
# How to install Node packages.
# Heads up: right now, Redwood expects this to be `node-modules`.
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.4.0.cjs

View File

@ -19,6 +19,7 @@ COPY --chown=node:node package.json .
COPY --chown=node:node api/package.json api/
COPY --chown=node:node web/package.json web/
COPY --chown=node:node yarn.lock .
COPY --chown=node:node .yarn/releases/yarn-4.4.0.cjs .yarn/releases/
RUN mkdir -p /home/node/.yarn/berry/index
RUN mkdir -p /home/node/.cache
@ -82,6 +83,7 @@ COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node package.json .
COPY --chown=node:node api/package.json api/
COPY --chown=node:node yarn.lock .
COPY --chown=node:node .yarn/releases/yarn-4.4.0.cjs .yarn/releases/
RUN mkdir -p /home/node/.yarn/berry/index
RUN mkdir -p /home/node/.cache
@ -122,6 +124,7 @@ COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node package.json .
COPY --chown=node:node web/package.json web/
COPY --chown=node:node yarn.lock .
COPY --chown=node:node .yarn/releases/yarn-4.4.0.cjs .yarn/releases/
RUN mkdir -p /home/node/.yarn/berry/index
RUN mkdir -p /home/node/.cache

View File

@ -6,6 +6,10 @@
"@redwoodjs/api": "8.3.0",
"@redwoodjs/api-server": "8.3.0",
"@redwoodjs/auth-dbauth-api": "8.3.0",
"@redwoodjs/graphql-server": "8.3.0"
"@redwoodjs/graphql-server": "8.3.0",
"crypto-js": "^4.2.0"
},
"devDependencies": {
"@types/crypto-js": "^4"
}
}

View File

@ -27,9 +27,10 @@ export const handler = async (event: APIGatewayEvent, _context: Context) => {
case '/oauth/microsoft/callback':
return await callback(event)
default:
return {
return await callback(event)
/*return {
statusCode: 404,
}
}*/
}
}

View File

@ -0,0 +1,8 @@
import type { ScenarioData } from '@redwoodjs/testing/api'
export const standard = defineScenario({
// Define the "fixture" to write into your test database here
// See guide: https://redwoodjs.com/docs/testing#scenarios
})
export type StandardScenario = ScenarioData<unknown>

View File

@ -0,0 +1,29 @@
import { mockHttpEvent, mockContext } from '@redwoodjs/testing/api'
import { handler } from './oauthStart'
// Improve this test with help from the Redwood Testing Doc:
// https://redwoodjs.com/docs/testing#testing-functions
describe('oauthStart function', () => {
it('Should respond with 200', async () => {
const httpEvent = mockHttpEvent({
queryStringParameters: {
id: '42', // Add parameters here
},
})
const response = await handler(httpEvent, mockContext())
const { data } = JSON.parse(response.body)
expect(response.statusCode).toBe(200)
expect(data).toBe('oauthStart function')
})
// You can also use scenarios to test your api functions
// See guide here: https://redwoodjs.com/docs/testing#scenarios
//
// scenario('Scenario test', async () => {
//
// })
})

View File

@ -0,0 +1,42 @@
import type { APIGatewayEvent, Context } from 'aws-lambda'
import { logger } from 'src/lib/logger'
/**
* The handler function is your code that processes http request events.
* You can use return and throw to send a response or error, respectively.
*
* Important: When deployed, a custom serverless function is an open API endpoint and
* is your responsibility to secure appropriately.
*
* @see {@link https://redwoodjs.com/docs/serverless-functions#security-considerations|Serverless Function Considerations}
* in the RedwoodJS documentation for more information.
*
* @typedef { import('aws-lambda').APIGatewayEvent } APIGatewayEvent
* @typedef { import('aws-lambda').Context } Context
* @param { APIGatewayEvent } event - an object which contains information from the invoker.
* @param { Context } _context - contains information about the invocation,
* function, and execution environment.
*/
export const handler = async (event: APIGatewayEvent, _context: Context) => {
logger.info(`${event.httpMethod} ${event.path}: oauth function`)
switch (event.path) {
case '/oauthStart/microsoft':
return await callback()
default:
return await callback()
/* return {
statusCode: 404,
} */
}
}
const callback = async () => {
return {
statusCode: 302,
headers: {
Location: `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${process.env.MICROSOFT_OAUTH_CLIENT_ID}&grant_type=authorization_code&response_type=code&redirect_uri=${process.env.MICROSOFT_OAUTH_REDIRECT_URI}&scope=${process.env.MICROSOFT_OAUTH_SCOPES.split(' ').join('+')}`,
},
}
}

View File

@ -8,11 +8,8 @@
[web]
title = "Redwood App"
port = 8910
apiUrl = "/.redwood/functions" # You can customize graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths
apiUrl = "/api" # You can customize graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths
includeEnvironmentVariables = [
"MICROSOFT_OAUTH_CLIENT_ID",
"MICROSOFT_OAUTH_SCOPES",
"MICROSOFT_OAUTH_REDIRECT_URI",
# Add any ENV vars that should be available to the web side to this array
# See https://redwoodjs.com/docs/environment-variables#web
]

View File

@ -53,11 +53,7 @@ export default function Hero() {
</p>
<div className="mt-10 flex items-center gap-x-6">
<a
href={`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${
process.env.MICROSOFT_OAUTH_CLIENT_ID
}&grant_type=authorization_code&response_type=code&redirect_uri=${
process.env.MICROSOFT_OAUTH_REDIRECT_URI
}&scope=${process.env.MICROSOFT_OAUTH_SCOPES.split(' ').join('+')}`}
href={`${window.RWJS_API_URL}/oauthStart/microsoft`}
className="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
>
Anmelden

View File

@ -7476,6 +7476,13 @@ __metadata:
languageName: node
linkType: hard
"@types/crypto-js@npm:^4":
version: 4.2.2
resolution: "@types/crypto-js@npm:4.2.2"
checksum: 10c0/760a2078f36f2a3a1089ef367b0d13229876adcf4bcd6e8824d00d9e9bfad8118dc7e6a3cc66322b083535e12be3a29044ccdc9603bfb12519ff61551a3322c6
languageName: node
linkType: hard
"@types/debug@npm:^4.1.7":
version: 4.1.12
resolution: "@types/debug@npm:4.1.12"
@ -8624,6 +8631,8 @@ __metadata:
"@redwoodjs/api-server": "npm:8.3.0"
"@redwoodjs/auth-dbauth-api": "npm:8.3.0"
"@redwoodjs/graphql-server": "npm:8.3.0"
"@types/crypto-js": "npm:^4"
crypto-js: "npm:^4.2.0"
languageName: unknown
linkType: soft
@ -20856,11 +20865,11 @@ __metadata:
"typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>":
version: 5.6.2
resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>::version=5.6.2&hash=8c6c40"
resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>::version=5.6.2&hash=74658d"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/94eb47e130d3edd964b76da85975601dcb3604b0c848a36f63ac448d0104e93819d94c8bdf6b07c00120f2ce9c05256b8b6092d23cf5cf1c6fa911159e4d572f
checksum: 10c0/e6c1662e4852e22fe4bbdca471dca3e3edc74f6f1df043135c44a18a7902037023ccb0abdfb754595ca9028df8920f2f8492c00fc3cbb4309079aae8b7de71cd
languageName: node
linkType: hard