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

Promote Qa to Prod - (User Invitations, integration tests) #245

Merged
merged 101 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
4772861
use postgres
eliobischof Oct 16, 2024
73a385c
setup playwright
eliobischof Oct 16, 2024
8c6d957
pipeline
eliobischof Oct 16, 2024
fe289e3
build and test
eliobischof Oct 16, 2024
ac7cbe5
test on pr
eliobischof Oct 16, 2024
5be0ed4
rename pipeline workflows
eliobischof Oct 16, 2024
2fa16d5
generate
eliobischof Oct 16, 2024
653b499
timeout
eliobischof Oct 16, 2024
f1b756b
submit username and password
eliobischof Oct 16, 2024
c5620e6
concurrent setup
eliobischof Oct 16, 2024
576cdcc
fail earlier
eliobischof Oct 16, 2024
ca0e551
kill -0
eliobischof Oct 16, 2024
be84e94
build with env
eliobischof Oct 16, 2024
17e516a
compose to background
eliobischof Oct 16, 2024
3ff49c3
wait individually
eliobischof Oct 16, 2024
c413805
await setup
eliobischof Oct 16, 2024
b058b75
default uid
eliobischof Oct 16, 2024
77fb366
use current user
eliobischof Oct 16, 2024
76430e1
use root
eliobischof Oct 16, 2024
5969b14
runneradmin
eliobischof Oct 16, 2024
4cb1795
root
eliobischof Oct 16, 2024
cb8f071
simplify setup
eliobischof Oct 16, 2024
f7796e3
Merge branch 'main' into acceptance-test-suite
peintnermax Oct 17, 2024
1134b9c
develop against local zitadel
eliobischof Oct 17, 2024
4606077
fix autocomplete for otp code
peintnermax Oct 18, 2024
94e2d31
invite and invite success pages
peintnermax Oct 18, 2024
18a1262
urlTemplate
peintnermax Oct 18, 2024
6883497
Merge branch 'acceptance-test-suite' of github.com:zitadel/typescript…
eliobischof Oct 18, 2024
1ca16f9
run acceptance
eliobischof Oct 18, 2024
7b43cac
remove gh workflow
eliobischof Oct 18, 2024
e58e8c5
generate before build
eliobischof Oct 18, 2024
087e815
fix conditions
eliobischof Oct 18, 2024
90f13b2
build before start
eliobischof Oct 18, 2024
46fb2ea
remove workspace packages
eliobischof Oct 18, 2024
a45c841
Merge branch 'qa' into acceptance-test-suite
eliobischof Oct 18, 2024
083bf5a
clean dependencies
eliobischof Oct 18, 2024
8290a6b
no sudo
eliobischof Oct 18, 2024
3fc6118
keep dir
eliobischof Oct 18, 2024
7cde73f
fmt
eliobischof Oct 18, 2024
614bb5d
debug path
eliobischof Oct 18, 2024
edffb99
run zitadel as root
eliobischof Oct 18, 2024
0459bea
build
eliobischof Oct 18, 2024
bdfbd94
no prestart
eliobischof Oct 18, 2024
3ce1703
start already built
eliobischof Oct 18, 2024
cc53c44
update test
eliobischof Oct 18, 2024
bfd8a7c
fmt
eliobischof Oct 18, 2024
98a5e04
auth methods on verify page
peintnermax Oct 21, 2024
8edd22a
fix verify response
peintnermax Oct 21, 2024
2f6ad37
revert method state
peintnermax Oct 21, 2024
8a88e93
error handling
peintnermax Oct 21, 2024
c626dd5
initial param for password set page, fix cookie overflow
peintnermax Oct 22, 2024
3fadf26
cookie overflow handling
peintnermax Oct 22, 2024
ebae556
error handling
peintnermax Oct 22, 2024
cde5f6c
component wrapping
peintnermax Oct 23, 2024
52ce921
tests, session using timestamp
peintnermax Oct 23, 2024
cb2d5d6
move auth setup to seperate page, create session after verification
peintnermax Oct 23, 2024
f45c530
redirect from server action
peintnermax Oct 23, 2024
c4da6fd
ts for cookie, loginname to verification
peintnermax Oct 24, 2024
4d0e4bc
loginname to authenticator setup
peintnermax Oct 24, 2024
fb656bc
fix overflow
peintnermax Oct 24, 2024
93413bd
fix register session
peintnermax Oct 24, 2024
35ec0ba
tests
peintnermax Oct 24, 2024
3b6291b
fix layout responsiveness
peintnermax Oct 24, 2024
facd27c
tests
peintnermax Oct 24, 2024
1c65dbd
block authentictor setup if one method is set
peintnermax Oct 25, 2024
5fd72f5
show authenticator button if no method set yet
peintnermax Oct 25, 2024
1616e60
cleanup logs
peintnermax Oct 25, 2024
e25c054
cleanup logs
peintnermax Oct 25, 2024
3e8e176
Merge pull request #233 from zitadel/invite-users
peintnermax Oct 25, 2024
fc3d8f0
Merge branch 'main' into qa
peintnermax Oct 25, 2024
4bd0f96
show auth setup for 0 auth methods
peintnermax Oct 25, 2024
0181f64
return
peintnermax Oct 25, 2024
76e3baa
clean error
peintnermax Oct 25, 2024
27d4f9b
clean error
peintnermax Oct 25, 2024
3a99d7f
always create session from /verify page, cleanup idp session, theme w…
peintnermax Oct 25, 2024
fe3ba12
stub for register
peintnermax Oct 25, 2024
870b2e9
stub ns
peintnermax Oct 25, 2024
0e07da3
Merge pull request #227 from zitadel/acceptance-test-suite
peintnermax Oct 28, 2024
c9c8af2
tests
peintnermax Oct 28, 2024
34e8738
logs
peintnermax Oct 28, 2024
b8039be
response mapping
peintnermax Oct 28, 2024
357d462
redirect from server
peintnermax Oct 28, 2024
0a9d11f
loading state
peintnermax Oct 28, 2024
a088e79
cleanup password register
peintnermax Oct 28, 2024
35f1e0b
redirect from server
peintnermax Oct 28, 2024
3566ae9
sessionid
peintnermax Oct 28, 2024
c8fd63a
hostname for localhost
peintnermax Oct 28, 2024
c6c15fe
mocked services
peintnermax Oct 28, 2024
4ccf0de
mock services
peintnermax Oct 29, 2024
402d15b
exclude verify tests
peintnermax Oct 29, 2024
164c7d6
revert mocked-services
peintnermax Oct 29, 2024
cd6a11e
fix tests
peintnermax Oct 29, 2024
fab3ed7
chore(test:integration): install cypress binary
eliobischof Oct 29, 2024
7873a71
always install and cache cypress
eliobischof Nov 2, 2024
4d86179
pnpm
eliobischof Nov 2, 2024
388c510
cleanup
eliobischof Nov 2, 2024
affe3c5
Merge pull request #251 from zitadel/install-cypress-binary
peintnermax Nov 11, 2024
427384e
i18n, finally
peintnermax Nov 11, 2024
771befc
simplify
peintnermax Nov 11, 2024
7cbdb09
cleanup loading states
peintnermax Nov 11, 2024
a88c114
rm comment
peintnermax Nov 11, 2024
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
68 changes: 43 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on: pull_request

jobs:
quality:
env:
ZITADEL_IMAGE: ghcr.io/zitadel/zitadel:v2.63.4
POSTGRES_IMAGE: postgres:17.0-alpine3.19

name: Ensure Quality

runs-on: ubuntu-latest
Expand All @@ -21,6 +25,7 @@ jobs:
- lint
- test:unit
- test:integration
- test:acceptance

steps:
- name: Checkout Repo
Expand All @@ -29,33 +34,14 @@ jobs:
- name: Setup Buf
uses: bufbuild/[email protected]

- name: Setup Node.js 20.x
uses: actions/[email protected]
with:
node-version: 20.x

- name: Setup pnpm
uses: pnpm/[email protected]

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/[email protected]
name: Setup pnpm cache
- name: Setup Node.js 20.x
uses: actions/[email protected]
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
node-version: 20.x
cache: 'pnpm'

- uses: actions/[email protected]
name: Setup Cypress binary cache
Expand All @@ -64,10 +50,42 @@ jobs:
key: ${{ runner.os }}-cypress-binary-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-cypress-binary-
if: ${{ matrix.command }} == "test:integration"
# The Cypress binary cache needs to be updated together with the pnpm dependencies cache.
# That's why we don't conditionally cache it using if: ${{ matrix.command == 'test:integration' }}

- name: Install Dependencies
run: pnpm install
run: pnpm install --frozen-lockfile

# We can cache the Playwright binary independently from the pnpm cache, because we install it separately.
# After pnpm install --frozen-lockfile, we can get the version so we only have to download the binary once per version.
- run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d ' ' -f 2)" >> $GITHUB_ENV
if: ${{ matrix.command == 'test:acceptance' }}

- uses: actions/[email protected]
name: Setup Playwright binary cache
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-binary-${{ env.PLAYWRIGHT_VERSION }}
restore-keys: |
${{ runner.os }}-playwright-binary-
if: ${{ matrix.command == 'test:acceptance' }}

- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
if: ${{ matrix.command == 'test:acceptance' && steps.playwright-cache.outputs.cache-hit != 'true' }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: ${{ matrix.command == 'test:acceptance' }}

- name: Run ZITADEL
run: ZITADEL_DEV_UID=root pnpm run-zitadel
if: ${{ matrix.command == 'test:acceptance' }}

- name: Create Production Build
run: pnpm build
if: ${{ matrix.command == 'test:acceptance' }}

- name: Check
id: check
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ packages/zitadel-server/src/app/proto
.idea
.vercel
.env*.local
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
51 changes: 38 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,32 +178,57 @@ To run the application make sure to install the dependencies with
pnpm install
```

then setup the environment for the login application which needs a `.env.local` in `/apps/login`.
Go to your instance and create a service user for the application having the `IAM_OWNER` manager role.
This user is required to have access to create users on your primary organization and reading policy data so it can be
restricted to your personal use case but we'll stick with `IAM_OWNER` for convenience. Create a PAT and copy the value to
paste it under the `ZITADEL_SERVICE_USER_TOKEN` key.
The file should look as follows:
then generate the GRPC stubs with

```
ZITADEL_API_URL=[yourinstanceurl]
ZITADEL_ORG_ID=[yourprimaryorg]
ZITADEL_SERVICE_USER_TOKEN=[yourserviceuserpersonalaccesstoken]
```sh
pnpm generate
```

then generate the GRPC stubs with
To run the application against a local ZITADEL instance, run the following command:

```sh
pnpm generate
pnpm run-zitadel
```

This sets up ZITADEL using docker compose and writes the configuration to the file `apps/login/.env.local`.

<details>
<summary>Alternatively, use another environment</summary>
You can develop against any ZITADEL instance in which you have sufficient rights to execute the following steps.
Just create or overwrite the file `apps/login/.env.local` yourself.
Add your instances base URL to the file at the key `ZITADEL_API_URL`.
Go to your instance and create a service user for the login application.
The login application creates users on your primary organization and reads policy data.
For the sake of simplicity, just make the service user an instance member with the role `IAM_OWNER`.
Create a PAT and copy it to the file `apps/login/.env.local` using the key `ZITADEL_SERVICE_USER_TOKEN`.
Also add the users ID to the file using the key `ZITADEL_SERVICE_USER_ID`.

The file should look similar to this:

```
ZITADEL_API_URL=https://zitadel-tlx3du.us1.zitadel.cloud
ZITADEL_SERVICE_USER_ID=289106423158521850
ZITADEL_SERVICE_USER_TOKEN=1S6w48thfWFI2klgfwkCnhXJLf9FQ457E-_3H74ePQxfO3Af0Tm4V5Xi-ji7urIl_xbn-Rk
```

and then run it with
</details>

Start the login application in dev mode:

```sh
pnpm dev
```

Open the login application with your favorite browser at `localhost:3000`.
Change the source code and see the changes live in your browser.

Make sure the application still behaves as expected by running all tests

```sh
pnpm test
```

To satisfy your unique workflow requirements, check out the package.json in the root directory for more detailed scripts.

### Deploy to Vercel

Expand Down
1 change: 0 additions & 1 deletion acceptance/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM golang:1.19-alpine
RUN apk add curl jq
RUN go install github.com/zitadel/[email protected]
COPY setup.sh /setup.sh
RUN chmod +x /setup.sh
ENTRYPOINT [ "/setup.sh" ]
35 changes: 19 additions & 16 deletions acceptance/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
zitadel:
user: "${ZITADEL_DEV_UID}"
Expand All @@ -8,32 +6,37 @@ services:
ports:
- "8080:8080"
volumes:
- ./machinekey:/machinekey
- ./pat:/pat
- ./zitadel.yaml:/zitadel.yaml
depends_on:
db:
condition: "service_healthy"

db:
image: "cockroachdb/cockroach:v22.2.2"
command: "start-single-node --insecure --http-addr :9090"
restart: 'always'
image: "${POSTGRES_IMAGE:-postgres:latest}"
environment:
- POSTGRES_USER=zitadel
- PGUSER=zitadel
- POSTGRES_DB=zitadel
- POSTGRES_HOST_AUTH_METHOD=trust
command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all -c shared_buffers=1GB -c work_mem=16MB -c effective_io_concurrency=100 -c wal_level=minimal -c archive_mode=off -c max_wal_senders=0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9090/health?ready=1"]
interval: "10s"
timeout: "30s"
test: ["CMD-SHELL", "pg_isready"]
interval: '10s'
timeout: '30s'
retries: 5
start_period: "20s"
start_period: '20s'
ports:
- "26257:26257"
- "9090:9090"
- 5432:5432

wait_for_zitadel:
image: curlimages/curl:8.00.1
command:
[
"/bin/sh",
"-c",
"i=0; while ! curl http://zitadel:8080/debug/ready && [ $$i -lt 30 ]; do sleep 1; i=$$((i+1)); done; [ $$i -eq 30 ] && exit 1 || exit 0",
"i=0; while ! curl http://zitadel:8080/debug/ready && [ $$i -lt 30 ]; do sleep 1; i=$$((i+1)); done; [ $$i -eq 120 ] && exit 1 || exit 0",
]
depends_on:
- zitadel
Expand All @@ -43,11 +46,11 @@ services:
container_name: setup
build: .
environment:
KEY: /key/zitadel-admin-sa.json
SERVICE: http://zitadel:8080
WRITE_ENVIRONMENT_FILE: /apps/login/.env.acceptance
PAT_FILE: /pat/zitadel-admin-sa.pat
ZITADEL_API_INTERNAL_URL: http://zitadel:8080
WRITE_ENVIRONMENT_FILE: /apps/login/.env.local
volumes:
- "./machinekey:/key"
- "./pat:/pat"
- "../apps/login:/apps/login"
depends_on:
wait_for_zitadel:
Expand Down
1 change: 0 additions & 1 deletion acceptance/machinekey/.gitignore

This file was deleted.

Empty file removed acceptance/machinekey/.kitkeep
Empty file.
2 changes: 2 additions & 0 deletions acceptance/pat/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitkeep
File renamed without changes.
Loading
Loading