Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Merge branch 'v3-master' into de-cf-schema-tree
Browse files Browse the repository at this point in the history
* v3-master:
  Fix cf summary unit test failures - cf now has dependency on autoscaler - see #3916
  catalogue: fixed initial state that was overwritten
  Travis: Build once and share build in e2e tests (#3901)
  Improve user clean up
  Ensure MB is only shown for memory based quota values in edit quota forms (#3892)
  Fix domains in create app shell stepper
  Fix git commit world
  WIP
  Fix two actionBuilder params issues - Fix three places where `includeRelations` were passed incorrectly to actionBuilder - Fix bind service
  Ensure multi endpoint requests only go out to connected/unconnectable endpoints - Fixes #3887
  Travis: Build once and share build in e2e tests (#3901)
  Improve user clean up
  Ensure MB is only shown for memory based quota values in edit quota forms (#3892)
  Add support for view and edit profile for local user (#3883)
  Add fix to wait until delete indicator has been removed (#3889)
  FIx setup detection for local users (#3888)
  Ensure stepper buttons are always visible and content scrolls (#3890)
  E2E Test should run as user not admin (#3894)
  • Loading branch information
KlapTrap committed Sep 25, 2019
2 parents 4aedb6e + 2399903 commit e5694b7
Show file tree
Hide file tree
Showing 51 changed files with 818 additions and 154 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cache:
- node_modules
stages:
- Lint
- Build
- Test
jobs:
include:
Expand All @@ -44,6 +45,12 @@ jobs:
script:
- golint src/jetstream/...
- ./deploy/ci/travis/update-go-report-card.sh
- stage: Build
name: Build Frontend and Backend
env:
- CI_ENV=true
script:
- "./deploy/ci/travis/e2e-build-script.sh build"
- stage: Test
name: Frontend Unit Tests
env:
Expand Down
10 changes: 10 additions & 0 deletions deploy/ci/automation/e2e-clean-remnants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,14 @@ clean "$USERS" "-" "delete-user" "^(acceptancee2etravis)(invite[0-9])(20[0-9]*)[
USERS=$(cf org-users -a e2e | grep "accept" | sed -e 's/^[[:space:]]*//')
clean "$USERS" "-" "delete-user" "^(acceptancee2etravis)(invite[0-9])(20[0-9]*)[Tt]([0-9]*)[zZ].*"

# Users without roles
echo "Cleaning users without roles"
USERS=$(cf curl "/v2/users?results-per-page=100" | jq -r .resources[].entity.username)
clean "$USERS" "-" "delete-user" "^(acceptance\.e2e\.travisci)(-remove-users)\.(20[0-9]*)[Tt]([0-9]*)[zZ].*"
clean "$USERS" "-" "delete-user" "^(acceptance\.e2e\.travis)(-remove-users)\.(20[0-9]*)[Tt]([0-9]*)[zZ].*"


echo "Done"

# Get users without usernames
#cf curl "/v2/users?results-per-page=10" | jq '.resources[] | { "username": .entity.username, "guid": .metadata.guid, "created": .metadata.created_at }' | jq 'select(.username==null)' | jq '. | select(.guid|match("^[0-9a-z]*-[0-9a-z]*-[0-9a-z]*[0-9a-z]*"))'
76 changes: 76 additions & 0 deletions deploy/ci/travis/e2e-build-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

echo "Stratos e2e build"
echo "================="

MC_HOST="s3"

LOCAL_BUILD="true"

# Use Travis env vars:
# TRAVIS_PULL_REQUEST
# TRAVIS_REPO_SLUG
# TRAVIS_COMMIT

if [ -z "$TRAVIS_REPO_SLUG" ]; then
echo "Need to be running in Trvis"
exit 1
fi

if [ -z "$TRAVIS_COMMIT" ]; then
echo "Need to be running in Trvis"
exit 1
fi

GIT_ID="${TRAVIS_REPO_SLUG}_${TRAVIS_COMMIT}_${TRAVIS_PULL_REQUEST}"
GIT_ID="${GIT_ID//\//_}"
echo $GIT_ID

TAR_NAME="${GIT_ID}.tar"
GZIP_NAME="${GIT_ID}.tgz"

# Ensure we have the mc command
DIRNAME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${DIRNAME}/e2e-mc-helper.sh"

function tryGetExistingBuild() {
echo "Looking for existing build: ${GIT_ID}"

mc cp -q --insecure ${MC_HOST}/${S3_BUILDS_BUCKET}/${GZIP_NAME} ./
if [ $? -eq 0 ]; then
# We found an existing build, so download and unpack it
echo "Downloading build package"
tar -xvf ${GZIP_NAME}
if [ $? -eq 0 ]; then
LOCAL_BUILD="false"
fi
rm -rf ${GZIP_NAME}
fi
}

if [ -n "${AWS_ENDPOINT}" ]; then
tryGetExistingBuild
fi

if [ "${LOCAL_BUILD}" == "false" ]; then
echo "Downloaded and unpacked an existing build - no need to build locally"
else

set -e

# Get go
curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
chmod +x ~/bin/gimme
eval "$(gimme 1.12.4)"
go version

npm run build
npm run build-backend

set +e
tar cvfz ${GZIP_NAME} dist/* src/jetstream/jetstream

# Upload
mc cp -q --insecure ${GZIP_NAME} ${MC_HOST}/${S3_BUILDS_BUCKET}

fi
19 changes: 19 additions & 0 deletions deploy/ci/travis/e2e-mc-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Helper for mc command

mc version > /dev/null
if [ $? -eq 0 ]; then
echo "mc command already installed and confgiured"
else
echo "Installing and configuring mc command ..."

wget https://dl.minio.io/client/mc/release/linux-amd64/mc
chmod +x mc
cp mc ~/bin

mc -install -y >/dev/null 2>&1

echo "Configuring mc client"
mc config host add s3 ${AWS_ENDPOINT} ${AWS_ACCESS_KEY_ID} ${AWS_SECRET_ACCESS_KEY} --insecure

echo "mc command ready"
fi
14 changes: 6 additions & 8 deletions deploy/ci/travis/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ echo "Using local deployment for e2e tests"
# Start a local UAA - this will take a few seconds to come up in the background
docker run -d -p 8080:8080 splatform/stratos-uaa

# Get go
curl -sL -o ~/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
chmod +x ~/bin/gimme
eval "$(gimme 1.12.4)"
go version

npm run build
npm run build-backend
# Build if needed or use existing build for this commit
DIRNAME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set +e
source "${DIRNAME}/e2e-build-script.sh"
set -e

# Copy travis config.properties file
cp deploy/ci/travis/config.properties src/jetstream/
pushd src/jetstream
Expand Down
14 changes: 4 additions & 10 deletions deploy/ci/travis/upload-e2e-test-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@ if [ -z "${AWS_ENDPOINT}" ]; then
exit 0
fi

wget https://dl.minio.io/client/mc/release/linux-amd64/mc
chmod +x mc
DIRNAME="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${DIRNAME}/e2e-mc-helper.sh"

echo "Uploading test report...."
echo "Uploading test report ..."

./mc -install -y

echo "Configuring upload client"
./mc config host add s3 ${AWS_ENDPOINT} ${AWS_ACCESS_KEY_ID} ${AWS_SECRET_ACCESS_KEY} --insecure

echo "Uploading ..."
# Sync the E2E reports
./mc cp -q --insecure -r e2e-reports s3/${S3_BUCKET}
mc cp -q --insecure -r e2e-reports s3/${S3_BUCKET}

if [[ $? != 0 ]]; then
echo 'Error uploading test reports: $?'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { EffectsModule } from '@ngrx/effects';

import { generateASEntities } from '../../cf-autoscaler/src/store/autoscaler-entity-generator';
import { generateStratosEntities } from '../../core/src/base-entity-types';
import { CATALOGUE_ENTITIES, EntityCatalogueFeatureModule } from '../../core/src/core/entity-catalogue.module';
import { entityCatalogue, TestEntityCatalogue } from '../../core/src/core/entity-catalogue/entity-catalogue.service';
Expand All @@ -23,7 +24,8 @@ import { CloudFoundryStoreModule } from './store/cloud-foundry.store.module';
testEntityCatalogue.clear();
return [
...generateCFEntities(),
...generateStratosEntities()
...generateStratosEntities(),
...generateASEntities(), // FIXME: CF should not depend on autoscaler. See #3916
];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import {

export const gitRepoActionBuilders = {
getRepoInfo: (
repoEntityID: string,
endpointGuid: string,
projectEnvVars: EnvVarStratosProject
) => new FetchGitHubRepoInfo(projectEnvVars)
} as OrchestratedActionBuilders;
Expand Down Expand Up @@ -46,7 +44,7 @@ export const gitCommitActionBuilders: GitCommitActionBuildersConfig = {
commitSha: string,
endpointGuid: string,
commitMeta: GitMeta
) => new FetchCommits(commitMeta.scm, commitSha, commitMeta.projectName)
) => new FetchCommits(commitMeta.scm, commitMeta.projectName, commitSha)
};

export interface GitBranchActionBuilders extends OrchestratedActionBuilders {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { Store } from '@ngrx/store';
import { combineLatest, Observable, of as observableOf } from 'rxjs';
import { catchError, filter, first, map, mergeMap, switchMap, tap } from 'rxjs/operators';

import { AssignRouteToApplication } from '../../../../../../cloud-foundry/src/actions/application-service-routes.actions';
import { CreateNewApplication } from '../../../../../../cloud-foundry/src/actions/application.actions';
import { GetOrganization } from '../../../../../../cloud-foundry/src/actions/organization.actions';
import { CreateRoute } from '../../../../../../cloud-foundry/src/actions/route.actions';
import { CFAppState } from '../../../../../../cloud-foundry/src/cf-app-state';
import {
applicationEntityType,
Expand All @@ -20,14 +17,14 @@ import { selectNewAppState } from '../../../../../../cloud-foundry/src/store/eff
import { selectCfRequestInfo } from '../../../../../../cloud-foundry/src/store/selectors/api.selectors';
import { CreateNewApplicationState } from '../../../../../../cloud-foundry/src/store/types/create-application.types';
import { IDomain } from '../../../../../../core/src/core/cf-api.types';
import { entityCatalogue } from '../../../../../../core/src/core/entity-catalogue/entity-catalogue.service';
import { EntityServiceFactory } from '../../../../../../core/src/core/entity-service-factory.service';
import { StepOnNextFunction } from '../../../../../../core/src/shared/components/stepper/step/step.component';
import { RouterNav } from '../../../../../../store/src/actions/router.actions';
import { getDefaultRequestState, RequestInfoState } from '../../../../../../store/src/reducers/api-request-reducer/types';
import { APIResource } from '../../../../../../store/src/types/api.types';
import { createEntityRelationKey } from '../../../../entity-relations/entity-relations.types';
import { entityCatalogue } from '../../../../../../core/src/core/entity-catalogue/entity-catalogue.service';
import { CF_ENDPOINT_TYPE } from '../../../../../cf-types';
import { createEntityRelationKey } from '../../../../entity-relations/entity-relations.types';
import { createGetApplicationAction } from '../../application.service';


Expand Down Expand Up @@ -168,8 +165,12 @@ export class CreateApplicationStep3Component implements OnInit {
this.newAppData = state;
const orgEntity = entityCatalogue.getEntity(CF_ENDPOINT_TYPE, organizationEntityType);
const getOrgActionBuilder = orgEntity.actionOrchestrator.getActionBuilder('get');
const getOrgAction = getOrgActionBuilder(state.cloudFoundryDetails.org, state.cloudFoundryDetails.cloudFoundry, [
createEntityRelationKey(organizationEntityType, domainEntityType)]);
const getOrgAction = getOrgActionBuilder(state.cloudFoundryDetails.org, state.cloudFoundryDetails.cloudFoundry, {
includeRelations: [
createEntityRelationKey(organizationEntityType, domainEntityType)
],
populateMissing: true
});

const orgEntService = this.entityServiceFactory.create<APIResource<any>>(
state.cloudFoundryDetails.org,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ export class DeployApplicationStep2Component
const commitSha = commit || branch.commit.sha;
const entityID = projectInfo.full_name + '-' + commitSha;
const gitCommitEntity = entityCatalogue.getEntity(CF_ENDPOINT_TYPE, gitCommitEntityType);
const fetchCommitActionBuilder = gitCommitEntity.actionOrchestrator.getActionBuilder('fetchCommit');
const fetchCommitAction = fetchCommitActionBuilder(this.scm, commitSha, projectInfo.full_name) as FetchCommit;
const fetchCommitActionBuilder = gitCommitEntity.actionOrchestrator.getActionBuilder('get');
const fetchCommitAction = fetchCommitActionBuilder(null, null, {
scm: this.scm,
projectName: projectInfo.full_name,
commitId: commitSha
}) as FetchCommit;
const commitEntityService = this.entityServiceFactory.create<EntityInfo>(
entityID,
fetchCommitAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ describe('CloudFoundrySummaryTabComponent', () => {
beforeEach(
async(() => {
TestBed.configureTestingModule({
declarations: [CloudFoundrySummaryTabComponent, CardCfInfoComponent, CardCfRecentAppsComponent, CompactAppCardComponent],
declarations: [
CloudFoundrySummaryTabComponent,
CardCfInfoComponent,
CardCfRecentAppsComponent,
CompactAppCardComponent
],
imports: generateCfBaseTestModules(),
providers: [...generateTestCfEndpointServiceProvider(), TabNavService]
providers: [
...generateTestCfEndpointServiceProvider(),
TabNavService
]
}).compileComponents();
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ export class CsiModeService {
const servceBindingEntity = entityCatalogue.getEntity(CF_ENDPOINT_TYPE, serviceBindingEntityType);
const actionBuilder = servceBindingEntity.actionOrchestrator.getActionBuilder('create');
const createServiceBindingAction = actionBuilder(
cfGuid,
guid,
cfGuid,
{ applicationGuid: appGuid, serviceInstanceGuid, params }
);
this.store.dispatch(createServiceBindingAction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ describe('CardCfInfoComponent', () => {
beforeEach(
async(() => {
TestBed.configureTestingModule({
declarations: [CardCfInfoComponent, MetadataItemComponent, BooleanIndicatorComponent],
declarations: [
CardCfInfoComponent,
MetadataItemComponent,
BooleanIndicatorComponent
],
imports: generateCfBaseTestModulesNoShared(),
providers: [generateTestCfEndpointService(), UserInviteService, ConfirmationDialogService]
providers: [
generateTestCfEndpointService(),
UserInviteService,
ConfirmationDialogService
]
}).compileComponents();
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class CardCfInfoComponent implements OnInit, OnDestroy {
map(entity => this.getDescription(entity))
);

// FIXME: CF should not depend on autoscaler. See #3916
this.autoscalerVersion$ = fetchAutoscalerInfo(this.cfEndpointService.cfGuid, this.esf).pipe(
map(e => e.entityRequestInfo.error ?
null :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ export class AppServiceBindingDataSource extends ListDataSource<APIResource<ISer
const serviceBindingEntity = entityCatalogue.getEntity(CF_ENDPOINT_TYPE, serviceBindingEntityType);
const actionBuilder = serviceBindingEntity.actionOrchestrator.getActionBuilder('getAllForApplication');
const getAppServiceBindingsAction = actionBuilder(
appGuid, cfGuid, paginationKey, [
createEntityRelationKey(serviceInstancesEntityType, servicePlanEntityType),
createEntityRelationKey(serviceInstancesEntityType, serviceEntityType),
createEntityRelationKey(serviceBindingEntityType, applicationEntityType),
createEntityRelationKey(serviceBindingEntityType, serviceInstancesEntityType),
]) as PaginatedAction;
appGuid, cfGuid, paginationKey, {
includeRelations: [
createEntityRelationKey(serviceInstancesEntityType, servicePlanEntityType),
createEntityRelationKey(serviceInstancesEntityType, serviceEntityType),
createEntityRelationKey(serviceBindingEntityType, applicationEntityType),
createEntityRelationKey(serviceBindingEntityType, serviceInstancesEntityType),
],
populateMissing: true
}) as PaginatedAction;
return getAppServiceBindingsAction;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Store } from '@ngrx/store';

import { CF_ENDPOINT_TYPE } from '../../../../../../../cloud-foundry/cf-types';
import { CFAppState } from '../../../../../../../cloud-foundry/src/cf-app-state';
import {
applicationEntityType,
Expand All @@ -22,7 +23,6 @@ import { APIResource } from '../../../../../../../store/src/types/api.types';
import { cfEntityFactory } from '../../../../../cf-entity-factory';
import { getRowMetadata } from '../../../../../features/cloud-foundry/cf.helpers';

import { CF_ENDPOINT_TYPE } from '../../../../../../../cloud-foundry/cf-types';
import { PaginatedAction } from '../../../../../../../store/src/types/pagination.types';
import { entityCatalogue } from '../../../../../../../core/src/core/entity-catalogue/entity-catalogue.service';

Expand All @@ -31,13 +31,16 @@ export class CfSpacesServiceInstancesDataSource extends ListDataSource<APIResour
const paginationKey = createEntityRelationPaginationKey(spaceEntityType, spaceGuid);
const serviceInstanceEntity = entityCatalogue.getEntity(CF_ENDPOINT_TYPE, serviceInstancesEntityType);
const actionBuilder = serviceInstanceEntity.actionOrchestrator.getActionBuilder('getAllInSpace');
const action = actionBuilder(spaceGuid, cfGuid, paginationKey, null, [
createEntityRelationKey(serviceInstancesEntityType, serviceBindingEntityType),
createEntityRelationKey(serviceInstancesEntityType, serviceEntityType),
createEntityRelationKey(serviceInstancesEntityType, servicePlanEntityType),
createEntityRelationKey(serviceInstancesEntityType, spaceEntityType),
createEntityRelationKey(serviceBindingEntityType, applicationEntityType),
], true, false) as PaginatedAction;
const action = actionBuilder(spaceGuid, cfGuid, paginationKey, null, {
includeRelations: [
createEntityRelationKey(serviceInstancesEntityType, serviceBindingEntityType),
createEntityRelationKey(serviceInstancesEntityType, serviceEntityType),
createEntityRelationKey(serviceInstancesEntityType, servicePlanEntityType),
createEntityRelationKey(serviceInstancesEntityType, spaceEntityType),
createEntityRelationKey(serviceBindingEntityType, applicationEntityType),
],
populateMissing: true
}) as PaginatedAction;
super({
store,
action,
Expand Down
Loading

0 comments on commit e5694b7

Please sign in to comment.