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

[19299] Deploy to staging #85

Merged
merged 33 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
79edf1d
Add staging pipeline file (#36)
alfonsograziano Jun 20, 2024
8db6f25
feat(cli): update seeder (#35)
nnorbert Jun 20, 2024
0388ae0
Add deploy stage to logto-admin (#38)
williamwd Jun 20, 2024
f5f22b2
fix(cli): fix logto pipeline (#40)
nnorbert Jun 21, 2024
3a4f1b2
fix(cli): fix seeder to handle empty data (#41)
nnorbert Jun 25, 2024
fc2e891
feat: logto uat changes (#43)
nnorbert Jun 27, 2024
c6663a8
Test migration command in Terraform (#48)
peschina Jun 28, 2024
73c5e48
18630 seed real roles (#45)
nnorbert Jun 28, 2024
5663928
chore(cli): rename seeder file (#52)
nnorbert Jun 28, 2024
a5a39b5
chore: use port 7001 instead of 5001 to avoid conflicts with forms (#56)
msebastianb Jul 2, 2024
a2a31aa
fix(cli): remove secrets from local seeder (#59)
alfonsograziano Jul 2, 2024
d31471c
feat(cli): seed is_third_party flag (#57)
nnorbert Jul 2, 2024
3a2954d
feat(cli): seed multiple redurect uris (#58)
nnorbert Jul 2, 2024
feb677a
Feature(ogcio): messaging integration (#60)
SamSalvatico Jul 2, 2024
f8d997b
Add MyGovId Mock service to Logto (#55)
alfonsograziano Jul 3, 2024
7364969
feat(cli): seeder updates already existing entries (#61)
nnorbert Jul 4, 2024
5f9a2db
Deploy STA in DEV (#63)
nnorbert Jul 4, 2024
45c1a9e
18941 deploy uat in dev (#68)
nnorbert Jul 5, 2024
27210ae
Add missing dev dependency in MyGovId mock service (#69)
peschina Jul 5, 2024
e00a1ff
Chore(OGCIO): makefile run native (#70)
SamSalvatico Jul 8, 2024
f07a612
chore: add default public servant user to mygovid mock service and re…
nnorbert Jul 9, 2024
5f75707
[18938] Improve DX (#71)
peschina Jul 9, 2024
7fdb973
Chore(mygovid): set fixed oid and sub (#73)
SamSalvatico Jul 9, 2024
a9081a8
chore(core): added docker compose db file (#75)
SamSalvatico Jul 10, 2024
33f0db3
[18938] Fix MyGovId mock service image push (#74)
peschina Jul 10, 2024
53b7ab5
[18938] Run with Docker Compose and remote images (#76)
peschina Jul 11, 2024
54fdd87
[18938] Fix yml file reference (#79)
peschina Jul 11, 2024
bbf682e
[19838] Add mock service to docker compose local file (#80)
peschina Jul 12, 2024
7a0bf92
Chore(OGCIO): messaging perms (#78)
SamSalvatico Jul 12, 2024
27fc505
[18938] Update command to point to HEAD (#81)
peschina Jul 12, 2024
fb8fe13
feat: added life events permissions (#77)
Jul 12, 2024
96ea9a6
[19299] Update to v1.18.0 (#82)
peschina Jul 16, 2024
24cb3b9
Merge branch 'sta' into 19299-deploy-to-staging
peschina Jul 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Default config
TRUST_PROXY_HEADER=1
DB_URL=postgresql://postgres:p0stgr3s@localhost:5433/logto
ADMIN_PORT=3302
PORT=3301

# OGCIO Config
MOCK_TOKEN_ENDPOINT=http://localhost:4005/logto/mock/token
MOCK_KEYS_ENDPOINT=http://localhost:4005/logto/mock/keys
13 changes: 9 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/packages/schemas/tables @simeng-li @wangsijie @gao-sun
/packages/core @simeng-li @wangsijie @gao-sun
/packages/console @wangsijie @charIeszhao @gao-sun
/packages/ui @simeng-li @charIeszhao
/.github/ @gao-sun
/.changeset @gao-sun
/packages/schemas/tables/ @simeng-li @wangsijie @gao-sun
/packages/core/ @simeng-li @wangsijie @gao-sun
/packages/console/ @wangsijie @charIeszhao @xiaoyijun @gao-sun
/packages/ui/ @simeng-li @charIeszhao
connector*/ @darcyYe @gao-sun

# The file below should be generated by the script, just in case someone accidentally edits it
/packages/console/src/assets/docs/guides/index.ts @gao-sun
33 changes: 24 additions & 9 deletions .github/workflows/alteration-compatibility-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
id: changes-detection
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE=$(git merge-base origin/${{github.base_ref}} HEAD)
BASE=$(git merge-base origin/${{ github.base_ref }} HEAD)
else
BASE=${{ github.event.before }}
fi
Expand All @@ -37,24 +37,25 @@ jobs:

if [ -n "$CHANGE_FILES" ]; then
echo "$CHANGE_FILES"
echo "::set-output name=has-alteration-changes::true"
echo "has-alteration-changes=true" >> $GITHUB_OUTPUT
echo "Alteration changes detected"
else
echo "::set-output name=has-alteration-changes::false"
echo "has-alteration-changes=false" >> $GITHUB_OUTPUT
echo "No alteration changes detected"
fi

package:
needs: check-alteration-changes
runs-on: ubuntu-latest
if: ${{needs.check-alteration-changes.outputs.has-alteration-changes == 'true'}}
if: ${{ needs.check-alteration-changes.outputs.has-alteration-changes == 'true' }}
env:
INTEGRATION_TEST: true
DEV_FEATURES_ENABLED: false
steps:
- uses: logto-io/actions-package-logto-artifact@v2
- uses: logto-io/actions-package-logto-artifact@v3
with:
artifact-name: alteration-integration-test-${{ github.sha }}
branch: ${{github.base_ref}}
branch: ${{ github.base_ref }}
pnpm-version: 9

run-logto:
Expand All @@ -66,13 +67,27 @@ jobs:
runs-on: ubuntu-latest
env:
INTEGRATION_TEST: true
DEV_FEATURES_ENABLED: false
DB_URL: postgres://postgres:postgres@localhost:5432/postgres

steps:
- uses: logto-io/actions-run-logto-integration-tests@v3
- uses: logto-io/actions-run-logto-integration-tests@v4
with:
branch: ${{github.base_ref}}
branch: ${{ github.base_ref }}
logto-artifact: alteration-integration-test-${{ github.sha }}
test-target: ${{ matrix.target }}
db-alteration-target: ${{github.head_ref}}
db-alteration-target: ${{ github.head_ref }}
pnpm-version: 9

# Automatically rerun the workflow since the integration tests are moody
# From this genius: https://github.com/orgs/community/discussions/67654#discussioncomment-8038649
rerun-on-failure:
needs: run-logto
if: failure() && fromJSON(github.run_attempt) < 3
runs-on: ubuntu-latest
steps:
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: gh workflow run rerun.yml -F run_id=${{ github.run_id }}
2 changes: 1 addition & 1 deletion .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
token: ${{ secrets.BOT_PAT }}

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fetch-depth: 0

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- master
- "push-action/**"
pull_request:

concurrency:
Expand All @@ -13,30 +12,51 @@ concurrency:

jobs:
package:
strategy:
matrix:
# Run the integration tests with and without dev features enabled
dev-features-enabled: [true, false]
runs-on: ubuntu-latest
env:
INTEGRATION_TEST: true
DEV_FEATURES_ENABLED: ${{ matrix.dev-features-enabled }}

steps:
- uses: logto-io/actions-package-logto-artifact@v2
- uses: logto-io/actions-package-logto-artifact@v3
with:
artifact-name: integration-test-${{ github.sha }}
artifact-name: integration-test-${{ github.sha }}-dev-features-${{ matrix.dev-features-enabled }}
pnpm-version: 9

run-logto:
strategy:
fail-fast: false
matrix:
target: [api, experience, console]
# Run the integration tests with and without dev features enabled
dev-features-enabled: [true, false]
needs: package
runs-on: ubuntu-latest
env:
INTEGRATION_TEST: true
DEV_FEATURES_ENABLED: ${{ matrix.dev-features-enabled }}
DB_URL: postgres://postgres:postgres@localhost:5432/postgres

steps:
- uses: logto-io/actions-run-logto-integration-tests@v3
- uses: logto-io/actions-run-logto-integration-tests@v4
with:
logto-artifact: integration-test-${{ github.sha }}
logto-artifact: integration-test-${{ github.sha }}-dev-features-${{ env.DEV_FEATURES_ENABLED }}
test-target: ${{ matrix.target }}
pnpm-version: 9

# Automatically rerun the workflow since the integration tests are moody
# From this genius: https://github.com/orgs/community/discussions/67654#discussioncomment-8038649
rerun-on-failure:
needs: run-logto
if: failure() && fromJSON(github.run_attempt) < 3
runs-on: ubuntu-latest
steps:
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: gh workflow run rerun.yml -r ${{ github.head_ref || github.ref_name }} -F run_id=${{ github.run_id }}
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand All @@ -53,7 +53,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
build-args: | # Test cloud build
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
run: cp ./fresh/pnpm-lock.yaml ./

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9
run-install: false
Expand All @@ -136,7 +136,7 @@ jobs:
# ** End **

- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v5
uses: ikalnytskyi/action-setup-postgres@v6

# ** Setup up-to-date databases and compare (test `up`) **
- name: Setup fresh database
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master-codecov-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Build and push docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
Expand All @@ -129,7 +129,7 @@ jobs:
fetch-depth: 0

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
fetch-depth: 0

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/rerun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# From this genius: https://github.com/orgs/community/discussions/67654#discussioncomment-8038649
name: Rerun workflow

on:
workflow_dispatch:
inputs:
run_id:
required: true
jobs:
rerun:
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run_id }}
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: |
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run_id }} --failed
2 changes: 1 addition & 1 deletion .github/workflows/upload-annotations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v4
uses: silverhand-io/actions-node-pnpm-run-steps@v5
with:
pnpm-version: 9

Expand Down
37 changes: 31 additions & 6 deletions .scripts/compare-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,46 @@ const queryDatabaseManifest = async (database) => {
`);

// This function removes the last segment of grantee since Logto will use 'logto_tenant_fresh/alteration' for the role name.
const normalizeGrantee = ({ grantee, ...rest }) => {
if (grantee.startsWith('logto_tenant_')) {
return { ...rest, grantee: 'logto_tenant' };
const normalizeRoleName = (roleName) => {
if (roleName.startsWith('logto_tenant_')) {
return 'logto_tenant';
}

return { grantee, ...rest };
// Removes the last segment of region grantee since Logto will use 'logto_region_xxx' for the role name for different regions.
if (roleName.startsWith('logto_region_')) {
return 'logto_region';
}

return roleName;
};

const normalizeGrantee = ({ grantee, ...rest }) => ({
...rest,
grantee: normalizeRoleName(grantee),
});

// Ditto.
const normalizeRoles = ({ roles: raw, ...rest }) => {
const roles = raw.slice(1, -1).split(',').map((name) => name.startsWith('logto_tenant_') ? 'logto_tenant' : name);
const roles = raw
.slice(1, -1)
.split(',')
.map((name) => normalizeRoleName(name));

return { roles, ...rest };
};

const normalizePolicyname = ({ policyname, ...rest }) => {
const prefix = 'allow_';
const suffix = '_access';
if (policyname && policyname.startsWith(prefix) && policyname.endsWith(suffix)) {
// This is a naming convention in Logto cloud, it is formatted as `allow_{role_name}_access`, we need to normalize the role name part for the convenience of comparing DB updates.
// Ref: https://github.com/logto-io/cloud/pull/738
return { policyname: `${prefix}${normalizeRoleName(policyname.slice(prefix.length, -suffix.length))}${suffix}`, ...rest };
}

return { policyname, ...rest };
};

// Omit generated ids and values
return {
tables: omitArray(tables, 'table_catalog'),
Expand Down Expand Up @@ -144,7 +169,7 @@ const queryDatabaseManifest = async (database) => {
indexes,
funcs,
triggers: omitArray(triggers, 'trigger_catalog', 'event_object_catalog'),
policies: policies.map(normalizeRoles),
policies: policies.map(normalizeRoles).map(normalizePolicyname),
columnGrants: omitArray(columnGrants, 'table_catalog').map(normalizeGrantee),
tableGrants: omitArray(tableGrants, 'table_catalog').map(normalizeGrantee),
};
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"timestamptz",
"topbar",
"upsell",
"withtyped"
"withtyped",
"backchannel"
]
}
Loading