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

UI CI #1935

Merged
merged 43 commits into from
May 31, 2022
Merged

UI CI #1935

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dea3925
Fix Guacamole refresh token (#1785)
anatbal May 9, 2022
b041eab
Add Contributor to the Role permissions (#1781)
ross-p-smith May 10, 2022
38290b9
Ignore Only Root index.html (#1800)
martinpeck May 10, 2022
710b215
Gitea/Guacamole should be able to access AAD_TENANT_ID (#1798)
ross-p-smith May 10, 2022
54907f8
shared services in pr bot and split out in tests (#1813)
damoodamoo May 11, 2022
a4b64be
Resource Processor: Configure logging handler per process (#1784)
tanya-borisova May 11, 2022
c24f371
Update TRE Developer doc for API (#1801)
tanya-borisova May 12, 2022
64656c9
E2E work with scope_id from workspace properties (#1797)
ross-p-smith May 12, 2022
8fe7231
Update docs on running End-to-end tests locally (#1829)
tanya-borisova May 13, 2022
fad5dcb
Fix check order in pr-bot (#1850)
stuartleeks May 17, 2022
d7fd8db
Next available IP range calculator only considers active workspaces (…
marrobi May 17, 2022
2457406
Increase Azure CLI version (#1864)
marrobi May 18, 2022
8af9adc
update all versions to 0.3 (#1754)
tamirkamara May 18, 2022
db7740c
Fix Firewall Logging (#1870)
martinpeck May 19, 2022
adc2a7c
Change how access properties in get_scope (#1882)
marrobi May 19, 2022
284c30d
added missing param for invoke-action (#1906)
damoodamoo May 23, 2022
6b9e92a
Add Bicep tools to devcontainer (#1848)
SvenAelterman May 23, 2022
dcb4380
E2E tests: Fix shared service and performance tests (#1860)
tanya-borisova May 24, 2022
c4ec6d4
shared services, tweaks to allow Create form to create any resource type
damoodamoo May 24, 2022
fb791ff
Merge branch 'feature/ui' into damoo/1808-shared-services
damoodamoo May 24, 2022
1acaea6
pivot areas used + resource history re-used across all resource types
damoodamoo May 24, 2022
313d34c
Add .terraform in .dockerignore files (#1872)
sonali-rajput May 24, 2022
05f572d
Bump pyjwt from 2.3.0 to 2.4.0 in /api_app (#1913)
dependabot[bot] May 25, 2022
b0d5614
Add resource id var to shared services. (#1914)
LizaShak May 25, 2022
c8678f1
add tflint config (#1919)
tamirkamara May 25, 2022
5be7d18
Update httpx package (#1917)
martinpeck May 25, 2022
7f5a5ac
Improve documentation for Resource Processor (#1827)
tanya-borisova May 26, 2022
350d8a0
Re-host Nexus on vm (#1584)
jjgriff93 May 26, 2022
bee34e1
Mandatory client-secret when creating a workspace (#1924)
ross-p-smith May 28, 2022
a89017d
disable app service's ftp (#1930)
tamirkamara May 29, 2022
10a79de
Airlock resources - tf scripts (#1843)
eladiw May 30, 2022
93dfa00
workspace nav fix
damoodamoo May 30, 2022
e22d5ca
Make etag required in API documentaiton, remove custom check (#1932)
SharonHart May 30, 2022
f892c60
Reimage Resource Processor Automatically (#1929)
tamirkamara May 30, 2022
1f0c396
initial swa deploy
damoodamoo May 30, 2022
dcc1ef3
Merge branch 'main' into damoo/ui-ci
damoodamoo May 30, 2022
b068f2e
swa deploy, CORS set
damoodamoo May 30, 2022
3bbf59e
SWA deployment
damoodamoo May 30, 2022
9908e60
post deploy manual step message
damoodamoo May 30, 2022
908fdd8
Merge branch 'feature/ui' of github.com:microsoft/AzureTRE into featu…
damoodamoo May 31, 2022
f6b4ffd
merged latest
damoodamoo May 31, 2022
addd241
defaulting ui location as global resource, fmt
damoodamoo May 31, 2022
aa7ebe5
deploy_ui feature flag
damoodamoo May 31, 2022
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
7 changes: 3 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ RUN bash /tmp/non-root-user.sh "${USERNAME}" "${USER_UID}" "${USER_GID}"
# Set env for tracking that we're running in a devcontainer
ENV DEVCONTAINER=true

# [Option] Install Node.js for GH actions tests and UI
ARG INSTALL_NODE="true"
# Install Node.js
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su $USERNAME -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
RUN su $USERNAME -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"

# Install terraform
ARG TERRAFORM_VERSION="1.1.5"
Expand Down Expand Up @@ -97,4 +96,4 @@ COPY ./.devcontainer/scripts/gh.sh /tmp/
RUN if [ "${INTERACTIVE}" = "true" ]; then /tmp/gh.sh; fi

# install SWA CLI
RUN if [ "${INSTALL_NODE}" = "true" ]; then npm install -g @azure/static-web-apps-cli; fi
RUN npm install -g @azure/static-web-apps-cli
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build-and-push-resource-processor: build-resource-processor-vm-porter-image push
build-and-push-gitea: build-gitea-image push-gitea-image
build-and-push-guacamole: build-guacamole-image push-guacamole-image
build-and-push-mlflow: build-mlflow-image push-mlflow-image
tre-deploy: deploy-core deploy-shared-services db-migrate show-core-output
tre-deploy: deploy-core build-and-deploy-ui deploy-shared-services db-migrate show-core-output
deploy-shared-services:
$(MAKE) firewall-install \
&& . ./devops/scripts/load_env.sh ./templates/core/.env \
Expand Down Expand Up @@ -348,6 +348,17 @@ static-web-upload:
&& . ${MAKEFILE_DIR}/devops/scripts/load_env.sh ${MAKEFILE_DIR}/templates/core/private.env \
&& ${MAKEFILE_DIR}/templates/core/terraform/scripts/upload_static_web.sh

build-and-deploy-ui:
$(call target_title, "Use Static Web App CLI to deploy UI") \
&& . ${MAKEFILE_DIR}/devops/scripts/check_dependencies.sh nodocker \
&& . ${MAKEFILE_DIR}/devops/scripts/load_env.sh ./templates/core/.env \
&& . ${MAKEFILE_DIR}/devops/scripts/load_env.sh ./devops/.env \
&& . ${MAKEFILE_DIR}/devops/scripts/load_terraform_env.sh ./devops/.env \
&& . ${MAKEFILE_DIR}/devops/scripts/load_terraform_env.sh ./templates/core/.env \
&& pushd ${MAKEFILE_DIR}/templates/core/terraform/ > /dev/null && . ./outputs.sh && popd > /dev/null \
&& . ${MAKEFILE_DIR}/devops/scripts/load_env.sh ${MAKEFILE_DIR}/templates/core/private.env \
&& ${MAKEFILE_DIR}/templates/core/terraform/scripts/build-deploy-ui.sh

prepare-for-e2e:
$(call workspace_bundle,base) \
&& $(call workspace_bundle,innereye) \
Expand Down
1 change: 1 addition & 0 deletions devops/.env.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Management infrastructure
LOCATION=__CHANGE_ME__
UI_LOCATION=__CHANGE_ME__ # current options are 'westus2,centralus,eastus2,westeurope,eastasia'. Note: will default to westeurope in TF (resource is seen as 'global' anyway)
MGMT_RESOURCE_GROUP_NAME=__CHANGE_ME__
MGMT_STORAGE_ACCOUNT_NAME=__CHANGE_ME__
TERRAFORM_STATE_CONTAINER_NAME=tfstate
Expand Down
4 changes: 2 additions & 2 deletions scripts/aad/aad-app-reg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ JSON

swaggerUIApp=$(jq -c . << JSON
{
"displayName": "${appName} Swagger UI",
"displayName": "${appName} Client Apps",
"signInAudience": "AzureADMyOrg",
"requiredResourceAccess": ${swaggerRequiredResourceAccess},
"spa": {
Expand All @@ -571,7 +571,7 @@ JSON
)

# Is the Swagger UI app already registered?
damoodamoo marked this conversation as resolved.
Show resolved Hide resolved
existingSwaggerUIApp=$(get_existing_app --name "${appName} Swagger UI")
existingSwaggerUIApp=$(get_existing_app --name "${appName} Client Apps")

if [[ -n ${existingSwaggerUIApp} ]]; then
swaggerUIAppObjectId=$(echo "${existingSwaggerUIApp}" | jq -r '.objectId')
Expand Down
2 changes: 2 additions & 0 deletions templates/core/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ SWAGGER_UI_CLIENT_ID=__CHANGE_ME__
# address of the deploying machine.
#PUBLIC_DEPLOYMENT_IP_ADDRESS=__CHANGE_ME__

# Uncomment and set this to true to deploy the UI provided as part of this repo
# DEPLOY_UI=true

####################################
# Useful developer settings
Expand Down
12 changes: 11 additions & 1 deletion templates/core/terraform/api-webapp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ locals {
version = replace(replace(replace(data.local_file.api_app_version.content, "__version__ = \"", ""), "\"", ""), "\n", "")
}

resource "azurerm_static_site" "tre-ui" {
count = var.deploy_ui ? 1 : 0
name = "ui-${var.tre_id}"
resource_group_name = azurerm_resource_group.core.name
location = var.ui_location
}

resource "azurerm_app_service_plan" "core" {
name = "plan-${var.tre_id}"
resource_group_name = azurerm_resource_group.core.name
Expand Down Expand Up @@ -77,7 +84,10 @@ resource "azurerm_app_service" "api" {
websockets_enabled = false

cors {
allowed_origins = []
allowed_origins = [
var.deploy_ui ? "https://${azurerm_static_site.tre-ui[0].default_host_name}" : "",
var.enable_local_debugging ? "http://localhost:3000" : ""
]
support_credentials = false
}

Expand Down
8 changes: 8 additions & 0 deletions templates/core/terraform/json-to-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ jq -r '
{
"path": "registry_server",
"env_var": "REGISTRY_SERVER"
},
{
"path": "ui_api_key",
"env_var": "UI_API_KEY"
},
{
"path": "ui_host_name",
"env_var": "UI_HOST_NAME"
}
]
as $env_vars_to_extract
Expand Down
6 changes: 0 additions & 6 deletions templates/core/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,3 @@ module "resource_processor_vmss_porter" {
azurerm_key_vault_access_policy.deployer
]
}

resource "azurerm_static_site" "tre-ui" {
name = "${var.tre_id}-ui"
resource_group_name = azurerm_resource_group.core.name
location = var.location
}
7 changes: 6 additions & 1 deletion templates/core/terraform/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,10 @@ output "registry_server" {
}

output "ui_api_key" {
value = azurerm_static_site.tre-ui.api_key
value = var.deploy_ui ? azurerm_static_site.tre-ui[0].api_key : ""
sensitive = true
}

output "ui_host_name" {
value = var.deploy_ui ? azurerm_static_site.tre-ui[0].default_host_name : ""
}
26 changes: 26 additions & 0 deletions templates/core/terraform/scripts/build-deploy-ui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

# skip if feature flag not set to true
if [ ! "${DEPLOY_UI}" == "true" ]; then
echo "Skipping UI deployment as DEPLOY_UI is not true"
exit 0
fi

pushd ./ui/app

# replace the values in the config file
jq --arg rootClientId "${SWAGGER_UI_CLIENT_ID}" \
damoodamoo marked this conversation as resolved.
Show resolved Hide resolved
--arg rootTenantId "${AAD_TENANT_ID}" \
--arg treApiClientId "${API_CLIENT_ID}" \
--arg treUrl "https://${FQDN}/api" \
'.rootClientId = $rootClientId | .rootTenantId = $rootTenantId | .treApiClientId = $treApiClientId | .treUrl = $treUrl' ./src/config.sample.json > ./src/config.json

# build and deploy the app
yarn install
yarn build
SWA_CLI_DEPLOYMENT_TOKEN="${UI_API_KEY}" swa deploy -a ./build -n "${TRE_ID}"-ui --env ""
echo "TRE UI deployed. Please add the above URI as a Redirect URI in the AAD 'TRE Client Apps (swagger app)' app. This is currently a manual step."

popd

12 changes: 12 additions & 0 deletions templates/core/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ variable "location" {
description = "Azure region for deployment of core TRE services"
}

variable "ui_location" {
type = string
description = "Azure region for the UI Static Web App. Options are: 'westus2,centralus,eastus2,westeurope,eastasia'"
default = "westeurope"
}

variable "deploy_ui" {
type = bool
description = "Feature flag to determine whether to deploy the inbuilt TRE UI or not"
default = false
}

variable "acr_name" {
type = string
description = "Management ACR name"
Expand Down
4 changes: 3 additions & 1 deletion ui/app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ yarn-debug.log*
yarn-error.log*
.eslintcache

!public/index.html
config.json

!public/index.html
5 changes: 4 additions & 1 deletion ui/app/src/components/workspaces/WorkspaceLeftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import { CreateUpdateResource } from '../shared/CreateUpdateResource/CreateUpdat
import { ResourceType } from '../../models/resourceType';
import { useBoolean } from '@fluentui/react-hooks';
import { WorkspaceContext } from '../../contexts/WorkspaceContext';
import { Resource } from '../../models/resource';

// TODO:
// - we lose the selected styling when navigating into a user resource. This may not matter as the user resource page might die away.
// - loading placeholders / error content(?)

interface WorkspaceLeftNavProps {
workspaceServices: Array<WorkspaceService>,
setWorkspaceService: (workspaceService: WorkspaceService) => void
setWorkspaceService: (workspaceService: WorkspaceService) => void,
addWorkspaceService: (w: WorkspaceService) => void
}

export const WorkspaceLeftNav: React.FunctionComponent<WorkspaceLeftNavProps> = (props:WorkspaceLeftNavProps) => {
Expand Down Expand Up @@ -90,6 +92,7 @@ export const WorkspaceLeftNav: React.FunctionComponent<WorkspaceLeftNavProps> =
onClose={closeCreatePanel}
resourceType={ResourceType.WorkspaceService}
parentResource={workspaceCtx.workspace}
onAddResource={(r: Resource) => props.addWorkspaceService(r as WorkspaceService)}
/>
</>
);
Expand Down
5 changes: 4 additions & 1 deletion ui/app/src/components/workspaces/WorkspaceProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ export const WorkspaceProvider: React.FunctionComponent = () => {
<WorkspaceHeader />
<Stack horizontal className='tre-body-inner'>
<Stack.Item className='tre-left-nav'>
<WorkspaceLeftNav workspaceServices={workspaceServices} setWorkspaceService={(ws: WorkspaceService) => setSelectedWorkspaceService(ws)} />
<WorkspaceLeftNav
workspaceServices={workspaceServices}
setWorkspaceService={(ws: WorkspaceService) => setSelectedWorkspaceService(ws)}
addWorkspaceService={(ws: WorkspaceService) => addWorkspaceService(ws)} />
</Stack.Item><Stack.Item className='tre-body-content'>
<Stack>
<Stack.Item grow={100}>
Expand Down
9 changes: 9 additions & 0 deletions ui/app/src/config.sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"rootClientId": "",
"rootTenantId": "",
"treApiClientId": "",
"treUrl": "https://my-tre.northeurope.cloudapp.azure.com/api",
"pollingDelayMilliseconds": 10000,
"loadAllOpsOnStart": true,
"debug": true
}