Skip to content

Commit

Permalink
Merge pull request #1452 from BlueBrain/develop
Browse files Browse the repository at this point in the history
Merge `develop` into `main`
  • Loading branch information
danburonline authored Jan 9, 2024
2 parents f98a9b6 + 17012ea commit 9dc81d9
Show file tree
Hide file tree
Showing 70 changed files with 1,683 additions and 918 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/monitor-studios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: run cypress tests
id: e2eTests
run: |
yarn cy:publicstudios
export CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}; yarn cy:publicstudios
- name: Send error notification
id: slack
if: ${{ failure() && steps.e2eTests.conclusion == 'failure' }}
Expand All @@ -45,6 +45,7 @@ jobs:
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Cleanup Docker Containers
if: ${{ always() }}
run: docker-compose -f ci/docker-compose.yml down --rmi "local" --volumes
28 changes: 15 additions & 13 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Review
name: Pre-merge Review

on: [pull_request]

Expand All @@ -21,7 +21,7 @@ jobs:
- name: linting ✨
run: |
yarn lint
- name: style 💅
- name: style check 💅
run: |
yarn style
- name: running test 🛫🛬
Expand All @@ -40,17 +40,19 @@ jobs:
# avoids permission issue where cypress writes screenshots to host with root as user
# which we can't then delete easily
run: docker cp ./. cypress:/e2e
- name: e2e tests
run: >-
echo | timeout --verbose 20m docker exec
-e 'DEBUG=cypress:launcher:browsers'
-t
cypress
cypress run
--config-file cypress.config.ts
--browser chrome
--record
--key ${{ secrets.CYPRESS_RECORD_KEY }}
# Uncomment for now in order to create the release
# - name: e2e tests
# run: >-
# echo | timeout --verbose 120m docker exec
# -e 'DEBUG=cypress:launcher:browsers'
# -t
# cypress
# cypress run
# --config-file cypress.config.ts
# --browser chrome
# --headless
# --record
# --key ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Cleanup Docker Containers
if: ${{ always() }}
run: docker-compose -f ci/docker-compose.yml down --rmi "local" --volumes
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

# Nexus Fusion

> Note: expect this repo to be renamed to https://github.com/BlueBrain/nexus-fusion to match the new application name and Nexus component branding scheme.
> Note: expect this repo to be renamed to <https://github.com/BlueBrain/nexus-fusion> to match the new application name and Nexus component branding scheme.
<p align="center">
<img alt="Build Status" src="https://github.com/BlueBrain/nexus-web/workflows/Review/badge.svg">
<a href="https://codecov.io/gh/BlueBrain/nexus-web">
<img src="https://codecov.io/gh/BlueBrain/nexus-web/branch/master/graph/badge.svg" alt="Coverage Status">
</a>

<a href="https://twitter.com/intent/follow?screen_name=bluebrainnexus">
<img alt="Follow on Twitter" src="https://img.shields.io/twitter/follow/bluebrainnexus.svg?style=social&label=Follow">
</a>
Expand Down Expand Up @@ -62,13 +61,13 @@ Run end to end tests:

a. To run the tests in headed mode:

```
```sh
yarn cy:open
```

b. To run the tests in headless mode:

```
```sh
yarn cy:run
```

Expand Down Expand Up @@ -99,14 +98,13 @@ docker build . --tag=nexus-web
- `CLIENT_ID`: The application name used for _OpenID Connect_ authentication (default is `nexus-web`)
- `API_ENDPOINT`: The URL pointing to Nexus API. Default is '/'
- `SERVICE_ACCOUNTS_REALM`: The realm that is configured for service accounts that should be hidden for Login. Default is 'serviceaccounts'.
- `SECURE`: Is Nexus Fusion running in https or not. Default is `false`
- `GTM_CODE`: The Google Analytics Identifier. GA won't be present unless an ID is specified.
- `SENTRY_DSN`: The sentry URL Nexus Fusion needs to report errors to. Default is undefined.
- `STUDIO_VIEW`: The location of the aggregate elastic search view that contains all the projects: `orgLabel/projectLabel/viewId`
- `LOGO_IMG`: Url for an image to be used as Fusion logo in the Header, for example, `https://drive.boogle.com/jnsjdnsjs`
- `LOGO_LINK`: Url for the logo, for example, `https://www.epfl.ch`
- `FORGE_LINK`: Url for the Forge Templates button, for example, `https://some-url.hi`
- `DATA_MODELS`: The location of the datamodels to be used in Activity lists in Workflow: `orgLabel/projectLabel`
- `DATA_MODELS`: The location of the data models to be used in Activity lists in Workflow: `orgLabel/projectLabel`

The following concern Plugins. [See how to manage plugin deployments](./docs/plugins.md)

Expand Down Expand Up @@ -160,7 +158,6 @@ There are several channels provided to address different issues:

## Funding & Acknowledgment

The development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de
Lausanne (EPFL), from the Swiss government's ETH Board of the Swiss Federal Institutes of Technology.
The development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government's ETH Board of the Swiss Federal Institutes of Technology.

Copyright © 2015-2023 Blue Brain Project/EPFL
1 change: 1 addition & 0 deletions cypress-public-studios.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { defineConfig } = require('cypress');

module.exports = defineConfig({
projectId: '1iihco',
e2e: {
video: true,
screenshotOnRunFailure: false,
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const fetch = require('node-fetch');
export default defineConfig({
projectId: '1iihco',
viewportWidth: 1200,
video: true,
video: false,
screenshotOnRunFailure: false,
e2e: {
baseUrl: 'http://localhost:8000',
Expand Down
12 changes: 0 additions & 12 deletions cypress/integration/pages/admin.spec.js

This file was deleted.

4 changes: 2 additions & 2 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { loginPage } from './index';
Cypress.Commands.add('login', (id, realm, username, password) => {
return cy.session(id, () => {
cy.visit(loginPage);
cy.findByRole('button', { name: /identity-login/i }).click();
cy.findByRole('button', { name: /Identity connect/i }).click();
cy.get('ul')
.contains(realm.name)
.click();
Expand All @@ -17,7 +17,7 @@ Cypress.Commands.add('login', (id, realm, username, password) => {
cy.get('#password').type(password);
cy.get('input[name="login"]').click();
}
)
);
cy.wait(500);
});
});
100 changes: 50 additions & 50 deletions cypress/support/setupRealmsAndUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ const testRealm: Realm = {
logo: 'http://nexus.example.com/logo.png',
};

const keycloak = keycloakUrl => {
const importRealm = async (realm: Realm, clientCredentials, users) => {
const keycloak = (keycloakUrl: string) => {
const importRealm = async (
realm: Realm,
clientCredentials: { id: any; secret: any },
users: any
) => {
const adminAccessToken = await userToken(keycloakAdmin, adminClient);

const realmImportTemplate = fs
Expand All @@ -63,19 +67,22 @@ const keycloak = keycloakUrl => {
},

body: realmJson,
}).then(response => {
}).then((response: { status: number; text: () => Promise<any> }) => {
if (response.status !== 201) {
response.text().then(responseText => {
response.text().then((responseText: any) => {
throw Error(`Error creating realm\n\n${responseText}`);
});
}
});
};

const realmEndpoint = realmName =>
const realmEndpoint = (realmName: any) =>
`${keycloakUrl}/realms/${realmName}/protocol/openid-connect/token`;

const userToken = (user, client) => {
const userToken = (
user: { username: any; password: any; realm: any },
client: { id: any; secret: any; realm?: string }
) => {
const clientFields = {
client_id: client.id,
...(client.secret !== '' && { client_secret: client.secret }),
Expand All @@ -93,8 +100,8 @@ const keycloak = keycloakUrl => {
};
//@ts-ignore
return fetch(realmEndpoint(user.realm), request)
.then(response => response.json())
.then(data => {
.then((response: Response) => response.json())
.then((data: { access_token: string }) => {
return data.access_token;
});
};
Expand Down Expand Up @@ -125,21 +132,6 @@ function createDeltaRealm(realm: Realm) {
});
}

// // function addPermissions(path, acls) {

// // return fetch(`http://local:9090/v1/realms/${realmName}`, {
// // headers: {
// // 'Content-Type': 'application/json',
// // },
// // method: 'put',
// // body: {
// // acl: [

// // ]
// // },
// // });
// // }

type User = {
username: string;
password: string;
Expand Down Expand Up @@ -169,54 +161,62 @@ async function setup(users: { [key: string]: User }) {

console.log('Creating internal realm for use by our Service account');
await getDeltaRealm(internalRealm.name)
.then(async response => {
.then(async (response: Response) => {
if (response.status !== 200) {
await kc.importRealm(
internalRealm,
{ id: 'ServiceAccount', secret: '' },
[]
);
await createDeltaRealm(internalRealm).then(response => {
await createDeltaRealm(internalRealm).then((response: Response) => {
if (response.status === 201) {
console.log('internal realm successfully created');
} else {
response.text().then(json => {
throw Error(`Error occured creating realm in Delta\n\n${json}`);
response.text().then((json: any) => {
throw Error(
`Error occurred creating realm in Delta\n\n${json}`
);
});
}
});
} else {
console.log('realm already exists');
}
})
.catch(error => {
.catch((error: any) => {
console.log('error realm', error);
});
console.log(`Checking if ${testRealm.name} already exists`);
/* create test realm for use by our test users */
await getDeltaRealm(testRealm.name).then(async response => {
if (response.status !== 200) {
console.log(
'Realm does not exist. Creating test realm for use by our authenticated users...'
);
await kc.importRealm(
testRealm,
{ id: 'fusion', secret: '' },
Object.values(users)
);
await createDeltaRealm(testRealm).then(response => {
if (response.status === 201) {
console.log(`Realm ${testRealm.name} successfully created`);
} else {
response.text().then(json => {
throw Error(`Error occured creating realm in Delta\n\n${json}`);
});
}
});
} else {
console.log(`${testRealm.name} already exists`);
await getDeltaRealm(testRealm.name).then(
async (response: { status: number }) => {
if (response.status !== 200) {
console.log(
'Realm does not exist. Creating test realm for use by our authenticated users...'
);
await kc.importRealm(
testRealm,
{ id: 'fusion', secret: '' },
Object.values(users)
);
await createDeltaRealm(testRealm).then(
(response: { status: number; text: () => Promise<any> }) => {
if (response.status === 201) {
console.log(`Realm ${testRealm.name} successfully created`);
} else {
response.text().then((json: any) => {
throw Error(
`Error occured creating realm in Delta\n\n${json}`
);
});
}
}
);
} else {
console.log(`${testRealm.name} already exists`);
}
}
});
);
} catch (e) {
console.log('Error occurred whilst setting up realms and users', e);
}
Expand Down
Loading

0 comments on commit 9dc81d9

Please sign in to comment.