Skip to content

Commit

Permalink
chore: Merge develop and feat-egress-store-role into feat-secure-work…
Browse files Browse the repository at this point in the history
…space-egress (#735)
  • Loading branch information
nguyen102 authored Oct 8, 2021
1 parent be76a91 commit 40d54e8
Show file tree
Hide file tree
Showing 99 changed files with 2,527 additions and 11,928 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy-integ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,38 @@ jobs:
branch: mainline
env:
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
check-beta-in-changelog:
name: Check Beta status
# Trigger to check and add Beta header if the latest commit isn't a release from standard-version or the last Add Beta
# workflow run
if: "!contains(github.event.head_commit.message, 'chore(release):') && !contains(github.event.head_commit.message, 'Add Beta')"
needs: merge-develop-to-mainline
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.MERGE_TOKEN }}
fetch-depth: 0
# There's no way for github actions to push to a protected branch. This is a workaround
# See https://git.luolix.topmunity/t/how-to-push-to-protected-branches-in-a-github-action/16101/30
- name: Temporarily disable branch protection
uses: octokit/request-action@v2.x
with:
route: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
owner: awslabs
repo: service-workbench-on-aws
branch: develop
env:
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
- name: Check if Beta is present and add if not
run: ./scripts/check-and-add-beta.sh
- name: Enable branch protection
uses: octokit/request-action@v2.x
if: always() # Make sure to enable branch protection even if other steps fail
with:
route: POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
owner: awslabs
repo: service-workbench-on-aws
branch: develop
env:
GITHUB_TOKEN: ${{ secrets.MERGE_TOKEN }}
36 changes: 18 additions & 18 deletions .github/workflows/mainline-protection.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: Mainline Protection
on:
pull_request:
branches:
- mainline
# The purpose of this workflow is to create a failing Status check on pull request against mainline. This will prevent
# PR from being merged into mainline.
jobs:
mainline-protection:
name: Only create PR against develop branch, not mainline branch
runs-on: ubuntu-18.04
steps:
- run: failing-command # An invalid bash command to trigger failure of this workflow
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: Mainline Protection
on:
pull_request:
branches:
- mainline
# The purpose of this workflow is to create a failing Status check on pull request against mainline. This will prevent
# PR from being merged into mainline.
jobs:
mainline-protection:
name: Only create PR against develop branch, not mainline branch
runs-on: ubuntu-18.04
steps:
- run: failing-command # An invalid bash command to trigger failure of this workflow
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## Beta
[This release is in beta. Click here to see changes since 3.4.0.](https://github.com/awslabs/service-workbench-on-aws/compare/v3.4.0...mainline)

## [3.4.0](https://github.com/awslabs/service-workbench-on-aws/compare/v3.3.1...v3.4.0) (2021-09-16)


### Features

* display Configuration Name and Instance Type on Workspace details card ([#669](https://github.com/awslabs/service-workbench-on-aws/issues/669)) ([f0fa819](https://github.com/awslabs/service-workbench-on-aws/commit/f0fa8191a22c33c9b669d56764cac676e6a1aaaa))
* Pre-populate variable values in input section of new workspace configuration ([#680](https://github.com/awslabs/service-workbench-on-aws/issues/680)) ([8ce51b2](https://github.com/awslabs/service-workbench-on-aws/commit/8ce51b200148108ac869e1a8ae26286b65c94cc1))


### Bug Fixes

* add label to stop timeout during e2e test ([#688](https://github.com/awslabs/service-workbench-on-aws/issues/688)) ([ff0b4cc](https://github.com/awslabs/service-workbench-on-aws/commit/ff0b4ccbb8349df7262469411bf23729be174621))
* end2end test terminated existing ws ([#685](https://github.com/awslabs/service-workbench-on-aws/issues/685)) ([9c74ac7](https://github.com/awslabs/service-workbench-on-aws/commit/9c74ac794aa75b4292291b9fa2f3768bed76eb81))
* github cypress setup ([#686](https://github.com/awslabs/service-workbench-on-aws/issues/686)) ([23f6d03](https://github.com/awslabs/service-workbench-on-aws/commit/23f6d0366f1b82eb569fe9fc363f47248d6e9011))
* go bug during deployment is handled ([#641](https://github.com/awslabs/service-workbench-on-aws/issues/641)) ([4c21a30](https://github.com/awslabs/service-workbench-on-aws/commit/4c21a305943f8c3b8436a0f4f534594ca5425ad4))
* no sagemaker autostop or EC2 stop lag ([#703](https://github.com/awslabs/service-workbench-on-aws/issues/703)) ([8cb199b](https://github.com/awslabs/service-workbench-on-aws/commit/8cb199b8093f5e799d2d87c228930a4929ebebb7))
* properly handle very long error messages on env update ([#705](https://github.com/awslabs/service-workbench-on-aws/issues/705)) ([d920abd](https://github.com/awslabs/service-workbench-on-aws/commit/d920abd8666eaf905810680aec24428e8ce46124))
* reset ForceLogout component upon relogin ([#640](https://github.com/awslabs/service-workbench-on-aws/issues/640)) ([5c2aaee](https://github.com/awslabs/service-workbench-on-aws/commit/5c2aaee79428c3d4e2bceb115b77a6eb477a6add))
* static namespace bug fix ([#615](https://github.com/awslabs/service-workbench-on-aws/issues/615)) ([bacb469](https://github.com/awslabs/service-workbench-on-aws/commit/bacb469d048601cc73f10a3d7145197fbeae8c62))
* sync UI and API func ([#709](https://github.com/awslabs/service-workbench-on-aws/issues/709)) ([a188b3c](https://github.com/awslabs/service-workbench-on-aws/commit/a188b3c918bea677acf5115cec006f50782e83bb))
* update int test readme to include adv test info ([#634](https://github.com/awslabs/service-workbench-on-aws/issues/634)) ([5453f5e](https://github.com/awslabs/service-workbench-on-aws/commit/5453f5e133672bc137bb61d5c3b8bf097152a851))

### Documentation

* New user guide PDF ([#704](https://github.com/awslabs/service-workbench-on-aws/pull/704)) ([d375785](https://github.com/awslabs/service-workbench-on-aws/commit/c560b95574d562dc8fc1c43a8b73bf2c70c3dd9a))

### [3.3.1](https://github.com/awslabs/service-workbench-on-aws/compare/v3.3.0...v3.3.1) (2021-07-26)


Expand Down
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ Service Workbench integrates existing AWS services, such as Amazon CloudFront, A

There are three types of Studies available in Service Workbench: My Studies, Organizational Studies and Open Data. Once you have created a Study you can upload files to it. Organizational Studies can be shared with other members in the organization. Owners of a study can amend the permissions of the study to grant access to other users. Once you have found the study or studies in which you are interested to perform research, you can deploy a workspace to attach the data to and conduct your research.

![Architecture](docs/docs/images/SWBArchitecture.png)
### Main account

This is the account where Service Workbench infrastructure is deployed.

![Architecture1](docs/docs/images/main_account.png)

### Hosting account

This is the account where compute resources are deployed.

![Architecture2](docs/docs/images/hosting_account.png)

## Service Workbench components

Expand Down Expand Up @@ -51,9 +60,22 @@ The solution also includes a Continuous Integration/Continuous Delivery feature:

# Installing Service Workbench

## Accessing documentation using Docusaurus
## Accessing Service Workbench Documentation

Service Workbench documentation can be accessed in the PDF format or by using the Docusaurus website.

### Documentation PDFs

You can download the PDF versions if you do not have Service Workbench locally installed on your machine. Click the following links to download:

+ [Service Workbench Installation Guide](/docs/Service_Workbench_Installation_Guide.pdf)
+ [Service Workbench Configuration Guide](/docs/Service_Workbench_Configuration_Guide.pdf)
+ [Service Workbench Post Deployment Guide](/docs/Service_Workbench_Post_Deployment_Guide.pdf)
+ [Service Workbench User's Guide](/docs/Service_Workbench_User_Guide.pdf)

### Accessing Documentation using Docusaurus

Read the Service Workbench Deployment Guide provided in the installation. You can now also launch the Service Workbench docusaurus website. Please follow the steps in docs/README.md
You first need to download the Service Workbench [source code](https://github.com/awslabs/service-workbench-on-aws/tags) on your local machine before accessing the documentation using Docusaurus. After downloading the source, you need to install Docusaurus so that you can launch the help site. For steps on how to install Docusaurus locally, read the [Documentation Readme](/docs/README.md).

## Software requirements

Expand Down Expand Up @@ -165,7 +187,7 @@ For more information, refer to *Service Workbench Installation Guide*.

Once Service Workbench is fully deployed, the console will output the Website URL and Root Password for Service Workbench. You can log in by navigating to the Website URL in any browser, and then using the username 'root' and the Root Password given by the console. Please note that logging as the root user is highly discouraged, and should only be used for initial setup. You can create a new user by clicking the "Users" tab on the left, then "Add Local User". Follow the instructions given to create the user (you can leave the 'Project' field blank for now), then log out of the root account and into your new user account.

Adding a local user should only be done in test environments. We highly recommend using an IDP for prod environments. For more details on how to set up an IDP, please click [here](/docs/docs/user_guide/sidebar/admin/auth/introduction.md)
Adding a local user should only be done in test environments. We highly recommend using an IDP for prod environments. For more details on how to set up an IDP, click [here](/docs/docs/user_guide/sidebar/admin/auth/introduction.md)
## Linking an existing AWS account

Once in your user account, you'll need to link your AWS account. Navigate to "AWS Accounts" in the left bar, then click the "AWS Accounts" tab. From here, you can create an AWS account, or link an existing one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const ScEnvironment = types
rev: types.maybe(types.number),
status: '',
description: '',
envTypeConfigId: '',
name: '',
projectId: '',
envTypeId: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { observer, inject } from 'mobx-react';
import { withRouter } from 'react-router-dom';
import { Header, Label, Popup, Icon, Divider, Message, Table, Grid, Segment } from 'semantic-ui-react';
import TimeAgo from 'react-timeago';
import { niceNumber } from '@aws-ee/base-ui/dist/helpers/utils';
import { niceNumber, swallowError } from '@aws-ee/base-ui/dist/helpers/utils';
import { isStoreLoading, isStoreNotEmpty, isStoreError } from '@aws-ee/base-ui/dist/models/BaseStore';
import ErrorBox from '@aws-ee/base-ui/dist/parts/helpers/ErrorBox';
import ProgressPlaceHolder from '@aws-ee/base-ui/dist/parts/helpers/BasicProgressPlaceholder';

import { isAppStreamEnabled } from '../../helpers/settings';
import By from '../helpers/By';
Expand All @@ -32,7 +35,40 @@ class ScEnvironmentCard extends React.Component {
return envType;
}

getEnvTypeConfigsStore() {
const configsStore = this.envTypesStore.getEnvTypeConfigsStore(this.environment.envTypeId);
return configsStore;
}

getConfiguration(envTypeConfigId) {
const configsStore = this.getEnvTypeConfigsStore();
const config = configsStore.getEnvTypeConfig(envTypeConfigId);
return config;
}

componentDidMount() {
const configsStore = this.getEnvTypeConfigsStore();
swallowError(configsStore.load());
}

render() {
const configsStore = this.getEnvTypeConfigsStore();
let content = null;

if (isStoreError(configsStore)) {
content = <ErrorBox error={configsStore.error} className="p0" />;
} else if (isStoreLoading(configsStore)) {
content = <ProgressPlaceHolder segmentCount={3} />;
} else if (isStoreNotEmpty(configsStore)) {
content = this.renderMain();
} else {
content = null;
}

return content;
}

renderMain() {
const env = this.environment;
const state = env.state;

Expand Down Expand Up @@ -66,6 +102,10 @@ class ScEnvironmentCard extends React.Component {
const studyCount = _.size(_.get(env, 'studyIds', []));
const envType = this.envType || {};

const config = this.getConfiguration(this.environment.envTypeConfigId);
const configName = config.name;
const instanceType = config.instanceType;

const renderRow = (key, value) => (
<Table.Row>
<Table.Cell width={5}>{key}</Table.Cell>
Expand All @@ -76,12 +116,14 @@ class ScEnvironmentCard extends React.Component {
);

return (
<Table definition>
<Table data-testid="environment-card-details-table" definition>
<Table.Body>
{renderRow('Owner', <By uid={env.createdBy} skipPrefix />)}
{renderRow('Studies', studyCount === 0 ? 'No studies linked to this workspace' : niceNumber(studyCount))}
{renderRow('Project', _.isEmpty(env.projectId) ? 'N/A' : env.projectId)}
{renderRow('Workspace Type', envType.name)}
{renderRow('Configuration Name', configName)}
{renderRow('Instance Type', instanceType)}
</Table.Body>
</Table>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import React from 'react';
import { shallow } from 'enzyme';

// Mock buttons to avoid error
jest.mock('../parts/ScEnvironmentButtons', () => ({
__ScEnvironmentButtons: true,
}));
// eslint-disable-next-line import/first
import {} from '../parts/ScEnvironmentButtons';

// const ScEnvironmentCard = require('../ScEnvironmentCard');
// eslint-disable-next-line import/first
import ScEnvironmentCard from '../ScEnvironmentCard';

jest.mock('@aws-ee/base-ui/dist/helpers/notification');
const displayErrorMock = require('@aws-ee/base-ui/dist/helpers/notification');

const scEnvironment = {
id: 'id',
rev: 2,
status: 'active',
description: 'sample description',
envTypeConfigId: 'env type config id',
name: 'name',
projectId: 'project id',
envTypeId: 'env type id',
createdAt: '01-01-1900',
createdBy: 'anonymous',
updatedAt: '01-02-1900',
updatedBy: 'anonymous',
error: 'error',
connections: [],
hasConnections: false,
studyIds: [],
cidr: [],
outputs: [],
};

const envTypesStore = {
getEnvTypeConfigsStore: jest.fn(() => envTypesStore),
load: jest.fn(),
getEnvTypeConfig: jest.fn(),
};

describe('ScEnvironmentCard', () => {
let component = null;
let wrapper = null;
beforeEach(() => {
// render component
wrapper = shallow(
<ScEnvironmentCard.WrappedComponent scEnvironment={scEnvironment} envTypesStore={envTypesStore} />,
);

// get instance of component
component = wrapper.instance();

// mock error function because it doesn't function properly in enzyme
displayErrorMock.displayError = jest.fn(x => x);
});

it('should get env type configs store', async () => {
// BUILD, OPERATE
component.getEnvTypeConfigsStore();

// CHECK
expect(envTypesStore.getEnvTypeConfigsStore).toHaveBeenCalledWith(scEnvironment.envTypeId);
});

it('should get configuration', async () => {
// BUILD
const spyOnConfigsStore = jest.spyOn(component, 'getEnvTypeConfigsStore');

// OPERATE
component.getConfiguration(scEnvironment.envTypeConfigId);

// CHECK
expect(spyOnConfigsStore).toHaveBeenCalled();
expect(envTypesStore.getEnvTypeConfig).toHaveBeenCalledWith(scEnvironment.envTypeConfigId);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class SelectConfigurationCards extends React.Component {
</div>
<Divider />
{this.renderEstimatedCostInfo(config)}
{this.renderInstanceType(config)}
</Card.Description>
</Card.Content>
</Card>
Expand Down Expand Up @@ -116,6 +117,17 @@ class SelectConfigurationCards extends React.Component {
return content;
}

renderInstanceType(config) {
const content = (
<div className="flex p1">
<div className="bold flex-auto">Instance Type</div>
<div className="pr1">{config.instanceType}</div>
</div>
);

return content;
}

renderTableInfo(config) {
// estimatedCostInfo
const priceTitle = item => {
Expand Down
Loading

0 comments on commit 40d54e8

Please sign in to comment.