diff --git a/delete-serverless-service-build-pack/Jenkinsfile b/delete-serverless-service-build-pack/Jenkinsfile index f21b7c7625..1dc34e2112 100644 --- a/delete-serverless-service-build-pack/Jenkinsfile +++ b/delete-serverless-service-build-pack/Jenkinsfile @@ -12,6 +12,7 @@ import groovy.transform.Field /** * The Service delete workflow for service types: API, function & website */ + @Field def configModule @Field def configLoader @Field def scmModule @@ -26,7 +27,7 @@ import groovy.transform.Field @Field def service_config @Field def context_map = [:] @Field def is_service_deletion = true; - +@Field def current_environment_id node { echo "Starting delete service job with params : $params" @@ -82,10 +83,17 @@ node { error "Service Id is not available." } + if(!service_config){ + error "Failed to fetch service metadata from catalog" + } environmentMetadataLoader.initialize(service_config, configLoader, scmModule, null, env.BUILD_URL, env.BUILD_ID, g_base_url + "/jazz/environments", auth_token) def environmentList = environmentMetadataLoader.getEnvironmentLogicalIds() echo "Environment List: $environmentList" + if (!events) { error "Can't load events module" } //Fail here + events.initialize(configLoader, service_config, "SERVICE_DELETION", "", "", g_base_url + "/jazz/events") + context_map = [created_by : service_config['created_by']] + if (environmentIds.size() > 0) { //validate each id in environment catalog for (_eId in environmentIds) { @@ -99,11 +107,7 @@ node { } } else if (environmentList.size() == 0) { echo "$repo_name doesn't contain any active environment logical id in environment catalog!" - } - - if (!events) { error "Can't load events module" } //Fail here - events.initialize(configLoader, service_config, "SERVICE_DELETION", "", "", g_base_url + "/jazz/events") - context_map = [created_by : service_config['created_by']] + } dir(repo_name){ echo "loadServerlessConfig......." @@ -136,6 +140,7 @@ node { updateServiceNameConfig() def path = getResourcePath() for (_envId in environmentIds) { + current_environment_id = _envId try { def branch = environmentMetadataLoader.getEnvironmentBranchName(_envId) if (branch && branch != 'NA') { @@ -164,6 +169,7 @@ node { updateServiceNameConfig() for (_envId in environmentIds) { + current_environment_id = _envId try { def branch = environmentMetadataLoader.getEnvironmentBranchName(_envId) if (branch && branch != 'NA') { @@ -186,6 +192,7 @@ node { case "WEBSITE": stage('Undeploy Website') { for (_envId in environmentIds) { + current_environment_id = _envId try { def branch = environmentMetadataLoader.getEnvironmentBranchName(_envId) echo "Branch ::: $branch" @@ -224,16 +231,16 @@ node { } -def handleFailureEvent(ex){ +def handleFailureEvent(errorMessage){ if (is_service_deletion) { - events.sendFailureEvent('DELETE_PROJECT', ex.getMessage(), context_map) + events.sendFailureEvent('DELETE_PROJECT', errorMessage, context_map) send_status_email("FAILED") - error "deleteProject failed. "+ ex.getMessage() + error "deleteProject failed. "+ errorMessage } else { - echo "error occured when Deleting Environment: " + ex + echo "error occured when Deleting Environment: " + errorMessage send_status_email("FAILED") - events.sendFailureEvent('DELETE_ENVIRONMENT', ex.getMessage(), null, _envId) - error "Environment cleanup for " + _envId + " failed! " + ex.getMessage() + events.sendFailureEvent('DELETE_ENVIRONMENT', errorMessage, null, current_environment_id) + error "Environment cleanup for " + current_environment_id + " failed! " + errorMessage } } @@ -262,7 +269,7 @@ def unDeployService(stage) { echo "Service undeployed" } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } } @@ -283,7 +290,7 @@ def checkoutSCM(repo_name) { [credentialsId: configLoader.REPOSITORY.CREDENTIAL_ID, url: repo_url] ]]) } catch (ex) { - handleFailureEvent(ex) + error "checkout SCM failed." } } } @@ -302,7 +309,7 @@ def updateServiceNameConfig() { sh "sed -i -- 's/name: \${self:service}/name: ${configLoader.INSTANCE_PREFIX}-${service_config['domain']}-${service_config['service']}/g' serverless.yml" writeServerlessFile() } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } @@ -352,7 +359,7 @@ def updateSwaggerConfig() { sh "sed -i -- 's/{conf-accId}/${roleId}/g' ./swagger/swagger.json" } } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } @@ -414,7 +421,7 @@ def cleanUpApiGatewayResources(stage, path) { } } } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } if (resource_id != null && resource_id != "") { def status_json = sh( @@ -432,7 +439,7 @@ def cleanUpApiGatewayResources(stage, path) { echo "Resource Id does not exists in API gateway." } } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } } @@ -493,7 +500,7 @@ def cleanUpApiDocs(stage) { def apiRootFolder = getApiDocsFolder(stage) sh "aws s3 rm s3://${apiRootFolder}/${service_config['domain']}/${service_config['service']}/${stage} --recursive" } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } } @@ -544,17 +551,48 @@ def getResourcePath() { resourcepath = (basePath + "/" + pathInfo).replaceAll("//", "/") return resourcepath } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } + +def generateAssetInfo(environment){ + def assetInfo = [:] + def s3Bucket + def assetBase + + if (configLoader.JAZZ.BUCKET_PER_SERVICE == "true") { + if (service_config['s3_bucket_name']) { + s3Bucket = service_config['s3_bucket_name'] + } else { + handleFailureEvent("Failed to get S3 bucket information from service catalog.") + } + assetBase = "${s3Bucket}" + assetInfo['asset_name'] = "${s3Bucket}-${environment}" + } else { + if (environment.endsWith("-dev")) { + s3Bucket = utilModule.getBucket('dev') + } else { + s3Bucket = utilModule.getBucket(environment) + } + assetBase = "${s3Bucket}/${service_config['domain']}-${service_config['service']}" + assetInfo['asset_name'] = "${s3Bucket}-${service_config['domain']}-${service_config['service']}-${environment}" + } + + assetInfo['s3Bucket'] = s3Bucket + assetInfo['asset_info'] = "${assetBase}/${environment}" + assetInfo['folder_name'] = "${assetBase}" + + return assetInfo +} + /** * Undeploy the website. Delete the web folder from S3 bucket * @param stage * @return */ def unDeployWebsite(stage) { - echo "unDeployWebsite::${service_config['service']}::${['domain']} ${['stage']}" + echo "unDeployWebsite::${service_config['service']}::${service_config['domain']} ${stage}" withCredentials([ [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: configLoader.AWS_CREDENTIAL_ID, secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'] @@ -565,27 +603,31 @@ def unDeployWebsite(stage) { sh "aws configure set profile.cloud-api.aws_secret_access_key $AWS_SECRET_ACCESS_KEY" sh "aws configure set preview.cloudfront true" - def bucketName - if (stage.endsWith("-dev")) { - bucketName = utilModule.getBucket('dev') - } else { - bucketName = utilModule.getBucket(stage) - } - echo "BucketName :: $bucketName" - def bucketUrl = "${bucketName}/${service_config['domain']}-${service_config['service']}/${stage}" - echo "BucketURL :: $bucketUrl" - def _exists = checkIfWebsiteExists(bucketUrl) + def assetInfo = generateAssetInfo(stage) + echo "BucketName :: ${assetInfo['s3Bucket']} and BucketURL :: ${assetInfo['asset_info']}" + def _exists = checkIfWebsiteExists(assetInfo['asset_info']) if (_exists) { - sh "aws s3 rm s3://${bucketUrl} --recursive" - cleanupS3BucketPolicy(stage, bucketName) + cleanupS3BucketPolicy(stage, assetInfo) + sh "aws s3 rm s3://${assetInfo['asset_info']} --recursive" } - def serviceS3FolderUrl = "${bucketName}/${service_config['domain']}-${service_config['service']}" - if (!checkIfBucketFolderHasObjects(serviceS3FolderUrl)) { - echo "Cleaning up service folder since service folder is empty:: $serviceS3FolderUrl" - sh "aws s3 rm s3://${serviceS3FolderUrl} --recursive" + def isEmpty + + if (configLoader.JAZZ.BUCKET_PER_SERVICE == "true") { + isEmpty = isBucketEmpty(assetInfo['folder_name']) + } else { + isEmpty = isBucketFolderEmpty(assetInfo['folder_name']) + } + + if (_exists && isEmpty) { + echo "Cleaning up service folder since service folder is empty:: ${assetInfo['asset_info']}" + if (configLoader.JAZZ.BUCKET_PER_SERVICE == "true") { + sh "aws s3 rb s3://${assetInfo['folder_name']} --force" + } else { + sh "aws s3 rm s3://${assetInfo['folder_name']} --recursive" + } } } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } } @@ -606,13 +648,24 @@ def checkIfWebsiteExists(bucketUrl) { return status } -def checkIfBucketFolderHasObjects(bucketFolderName){ - def status = true; +def isBucketEmpty(bucketName){ + def status = false; + try { + sh("aws s3api list-objects --bucket ${bucketName} --output json --query '[length(Contents[])]'") + } catch (ex) { + echo "Bucket $bucketName is empty" + status = true + } + return status +} + +def isBucketFolderEmpty(bucketFolderName){ + def status = false; try { sh("aws s3 ls s3://${bucketFolderName} --output json --query '[length(Contents[])]'") } catch (ex) { echo "Bucket $bucketFolderName is empty" - status = false + status = true } return status } @@ -624,7 +677,7 @@ def checkIfBucketFolderHasObjects(bucketFolderName){ * @param stage * @return */ -def cleanupS3BucketPolicy(stage, bucket) { +def cleanupS3BucketPolicy(stage, assetInfo) { echo "cleanupS3BucketPolicy called" withCredentials([ @@ -635,9 +688,8 @@ def cleanupS3BucketPolicy(stage, bucket) { sh "aws configure set profile.cloud-api.aws_access_key_id $AWS_ACCESS_KEY_ID" sh "aws configure set profile.cloud-api.aws_secret_access_key $AWS_SECRET_ACCESS_KEY" sh "aws configure set preview.cloudfront true" - def folderName = "${service_config['domain']}-${service_config['service']}/${stage}" def bucketPolicy = sh( - script: "aws s3api get-bucket-policy --bucket ${bucket} --output json", + script: "aws s3api get-bucket-policy --bucket ${assetInfo['s3Bucket']} --output json", returnStdout: true ).trim() def policyObject = parseJson(parseJson(bucketPolicy).Policy) @@ -645,23 +697,25 @@ def cleanupS3BucketPolicy(stage, bucket) { policyObjectUpdated.Version = policyObject.Version policyObjectUpdated.Id = policyObject.Id def statements = [] - def resourcePattern = "${bucket}/${folderName}/" for (items in policyObject.Statement) { - if (items.Sid != folderName || !(items.Resource.indexOf(resourcePattern) > -1)) { + if ((items.Sid != "list-${assetInfo['asset_name']}")) { def copy = [:] copy.putAll(items) statements.add(copy) } } - policyObjectUpdated.Statement = statements - def policy_json = JsonOutput.toJson(policyObjectUpdated) - //def bucketName = bucket - updateBucketPolicy(policy_json, bucket) + + echo "updated Policy : $statements" + if (statements.size() > 0) { + policyObjectUpdated.Statement = statements + def policy_json = JsonOutput.toJson(policyObjectUpdated) + updateBucketPolicy(policy_json, assetInfo['s3Bucket']) + } resetCredentials() } catch (ex) { resetCredentials() if (ex.getMessage().indexOf("groovy.json.internal.LazyMap") < 0) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } } @@ -684,7 +738,7 @@ def updateBucketPolicy(policy_json, bucketName){ --bucket "+ bucketName + " \ --policy \'${policy_json}\'" } catch (e) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } /** @@ -718,44 +772,47 @@ def cleanupCloudFrontDistribution(stage) { if ((ex.getMessage()).indexOf("getDistributionId Failed") > -1) { echo "Could not find a CloudFront distribution Id for service: ${service_config['service']} and environment $stage" } else { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } } - } /** - * Get the CloudFront distribution Id corresponding to the service - * @param service - * @param stage - * @return + * Get dist Id if exists + * */ -def getDistributionId(stage) { +def getDistributionId(environment) { def distributionID - def outputStr try { - def cloudFrontId = "${configLoader.INSTANCE_PREFIX}-${stage}-static-website-origin-${service_config['domain']}-${service_config['service']}" - echo "CloudFront ID: $cloudFrontId" - outputStr = sh( - script: "aws cloudfront list-distributions \ - --output json \ - --query \"DistributionList.Items[?Origins.Items[?Id=='${cloudFrontId}']].{Distribution:domainName, Id:Id}\"", - returnStdout: true - ) - + def outputStr = listDistribution(environment) if (outputStr) { + echo "### OutputStr for getting Distribution Id: $outputStr" def outputObj = new JsonSlurper().parseText(outputStr) - - if (outputObj) { + if (outputObj && outputObj[0].Id) { distributionID = outputObj[0].Id } } + return distributionID } catch (ex) { - error "getDistributionId Failed: "+ ex.getMessage() + return distributionID } +} - return distributionID +def listDistribution(environment){ + def outputStr = null + def service = "${service_config['domain']}-${service_config['service']}" + try { + outputStr = sh( + script: "aws cloudfront list-distributions \ + --output json \ + --query \"DistributionList.Items[?Origins.Items[?Id=='${configLoader.INSTANCE_PREFIX}-${environment}-static-website-origin-$service']].{Distribution:DomainName, Id:Id}\"", + returnStdout: true + ) + return outputStr + } catch (ex) { + return outputStr + } } /** @@ -773,7 +830,7 @@ def getDistributionConfig(distributionID) { ) return distributionConfig } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } @@ -800,7 +857,7 @@ def generateDistributionConfigForDisable(distributionConfig) { } catch (ex) { } return eTag } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } @@ -831,7 +888,7 @@ def disableCloudFrontDistribution(distributionID, _Etag, configFile, stage) { echo "disable eTag...$eTag" return eTag } catch (ex) { - handleFailureEvent(ex) + handleFailureEvent(ex.getMessage()) } } @@ -919,7 +976,7 @@ def setCredentials() { return tokenJson_token } catch (e) { - handleFailureEvent(ex) + echo "Failed to fetch authentication details." } } } @@ -930,7 +987,6 @@ def setCredentials() { * @return */ def send_status_email (build_status) { - def email_id = '' def email_content = '' def body_subject = '' @@ -956,12 +1012,12 @@ def send_status_email (build_status) { } def fromStr = 'Jazz Admin <' + configLoader.JAZZ.ADMIN + '>' body = JsonOutput.toJson([ - from : fromStr, - to : email_id, - subject : body_subject, - text : body_text, - cc : cc_email, - html : body_html + from : fromStr, + to : service_config['created_by'], + subject : body_subject, + text : body_text, + cc : cc_email, + html : body_html ]) try { def sendMail = sh(script: "curl -X POST \ diff --git a/jazz-build-module/service-configuration-data-loader.groovy b/jazz-build-module/service-configuration-data-loader.groovy index eac6f7e297..c20fcab954 100644 --- a/jazz-build-module/service-configuration-data-loader.groovy +++ b/jazz-build-module/service-configuration-data-loader.groovy @@ -54,7 +54,22 @@ def loadServiceConfigurationData() { sh "sed -i -- 's/{conf-jenkins-host}/${jenkins_url}/g' ./index.js" } - if ( (service_name.trim() == "jazz_scm-webhook") ) { + if ( (service_name.trim() == "jazz_deployments") ) { + sh "sed -i -- 's/{conf_stack_prefix}/${config_loader.INSTANCE_PREFIX}/g' ./config/dev-config.json" + sh "sed -i -- 's/{conf_stack_prefix}/${config_loader.INSTANCE_PREFIX}/g' ./config/stg-config.json" + sh "sed -i -- 's/{conf_stack_prefix}/${config_loader.INSTANCE_PREFIX}/g' ./config/prod-config.json" + + sh "sed -i -- 's/{jazz_admin}/${config_loader.JAZZ.ADMIN}/g' ./config/dev-config.json" + sh "sed -i -- 's/{jazz_admin}/${config_loader.JAZZ.ADMIN}/g' ./config/stg-config.json" + sh "sed -i -- 's/{jazz_admin}/${config_loader.JAZZ.ADMIN}/g' ./config/prod-config.json" + + sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/dev-config.json" + sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/stg-config.json" + sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/prod-config.json" + } + + if ((service_name.trim() == "jazz_scm-webhook")) { + sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["DEV"])}/g' ./config/dev-config.json" sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["STG"])}/g' ./config/stg-config.json" sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["PROD"])}/g' ./config/prod-config.json" @@ -65,7 +80,7 @@ def loadServiceConfigurationData() { } - if ( (service_name.trim() == "jazz_environments") ) { + if ((service_name.trim() == "jazz_environments")) { sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["DEV"])}/g' ./config/dev-config.json" sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["STG"])}/g' ./config/stg-config.json" sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["PROD"])}/g' ./config/prod-config.json" @@ -101,6 +116,24 @@ def loadServiceConfigurationData() { sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/prod-config.json" } + if ((service_name.trim() == "jazz_deployments-event-handler")) { + sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["DEV"])}/g' ./config/dev-config.json" + sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["STG"])}/g' ./config/stg-config.json" + sh "sed -i -- 's/{conf-apikey}/${utilModule.getAPIIdForCore(config_loader.AWS.API["PROD"])}/g' ./config/prod-config.json" + + sh "sed -i -- 's/{conf-region}/${region}/g' ./config/dev-config.json" + sh "sed -i -- 's/{conf-region}/${region}/g' ./config/stg-config.json" + sh "sed -i -- 's/{conf-region}/${region}/g' ./config/prod-config.json" + + sh "sed -i -- 's/{jazz_admin}/${config_loader.JAZZ.ADMIN}/g' ./config/dev-config.json" + sh "sed -i -- 's/{jazz_admin}/${config_loader.JAZZ.ADMIN}/g' ./config/stg-config.json" + sh "sed -i -- 's/{jazz_admin}/${config_loader.JAZZ.ADMIN}/g' ./config/prod-config.json" + + sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/dev-config.json" + sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/stg-config.json" + sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/prod-config.json" + } + if ((service_name.trim() == "jazz_events")) { sh "sed -i -- 's/{conf_stack_prefix}/${config_loader.INSTANCE_PREFIX}/g' ./config/dev-config.json" sh "sed -i -- 's/{conf_stack_prefix}/${config_loader.INSTANCE_PREFIX}/g' ./config/stg-config.json" @@ -180,7 +213,7 @@ def loadServiceConfigurationData() { sh "sed -i -- 's/{jazz_admin_creds}/${config_loader.JAZZ.PASSWD}/g' ./config/prod-config.json" } - if ((service_name.trim() == "jazz_delete-serverless-service") || (service_name.trim() == "jazz_create-serverless-service")) { + if ((service_name.trim() == "jazz_delete-serverless-service") || (service_name.trim() == "jazz_create-serverless-service") || (service_name.trim() == "jazz_deployments")) { sh "sed -i -- 's/{conf-jenkins-host}/${jenkins_url}/g' ./config/dev-config.json" sh "sed -i -- 's/{conf-jenkins-host}/${jenkins_url}/g' ./config/stg-config.json" sh "sed -i -- 's/{conf-jenkins-host}/${jenkins_url}/g' ./config/prod-config.json" @@ -305,7 +338,8 @@ def setUtilModule(util){ utilModule = util } def setKinesisStream(config){ - if ((config['service'].trim() == "services-handler") || (config['service'].trim() == "events-handler") || (config['service'] == "environment-event-handler")) { + if ((config['service'].trim() == "services-handler") || (config['service'].trim() == "events-handler") || + (config['service'] == "environment-event-handler") || (config['service'] == "deployments-event-handler")) { def function_name = "${config_loader.INSTANCE_PREFIX}-${config['domain']}-${config['service']}-${current_environment}" def event_source_list = sh( script: "aws lambda list-event-source-mappings --query \"EventSourceMappings[?contains(FunctionArn, '$function_name')]\" --region \"$region\"", diff --git a/jazz-ui/.gitignore b/jazz-ui/.gitignore index 2dda819842..ded97c4823 100644 --- a/jazz-ui/.gitignore +++ b/jazz-ui/.gitignore @@ -30,4 +30,14 @@ */target/ .nyc_output/ npm-debug.log -*/package-lock.json \ No newline at end of file +*/package-lock.json +testem.log +/typings + +# e2e +/e2e/*.js +/e2e/*.map + +#System Files +.DS_Store +Thumbs.db diff --git a/jazz-ui/Jenkinsfile_Platform b/jazz-ui/Jenkinsfile_Platform index f145af41d9..3943ebc549 100644 --- a/jazz-ui/Jenkinsfile_Platform +++ b/jazz-ui/Jenkinsfile_Platform @@ -74,16 +74,25 @@ node () { dir('jazz-ui') { checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: config_loader.REPOSITORY.CREDENTIAL_ID, url: scmModule.getCoreRepoCloneUrl("jazz-ui")]]]) def jazz_prod_api_id = utilModule.getAPIIdForCore(config_loader.AWS.API["PROD"]) - + + if(config_loader.UI_CONFIG.service_tabs.overview) sh "sed -i 's/{overview}/overview/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.service_tabs.access_control) sh "sed -i 's/{access control}/access control/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.service_tabs.metrics) sh "sed -i 's/{metrics}/metrics/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.service_tabs.cost) sh "sed -i 's/{cost}/cost/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.service_tabs.logs) sh "sed -i 's/{logs}/logs/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.environment_tabs.overview) sh "sed -i 's/{env_overview}/overview/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.environment_tabs.deployments) sh "sed -i 's/{deployments}/deployments/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.environment_tabs.code_quality) sh "sed -i 's/{code quality}/code quality/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.environment_tabs.assets) sh "sed -i 's/{assets}/assets/g' ./src/environments/environment.oss.ts"; + if(config_loader.UI_CONFIG.environment_tabs.logs) sh "sed -i 's/{env_logs}/logs/g' ./src/environments/environment.oss.ts"; sh "sed -i 's/{api_doc_name}/${config_loader.AWS.S3.API_DOC}/g' ./src/environments/environment.oss.ts" sh "sed -i 's/{API_GATEWAY_KEY_PROD}/${jazz_prod_api_id}/g' ./src/environments/environment.oss.ts" sh "sed -i 's/{inst_region}/${config_loader.AWS.REGION}/g' ./src/environments/environment.oss.ts" sh "sed -i 's/{multi_env}/${config_loader.UI_CONFIG.feature.multi_env}/g' ./src/environments/environment.oss.ts" - sh "sed -i 's/{service_tabs}/${config_loader.UI_CONFIG.service_tabs}/g' ./src/environments/environment.oss.ts" - sh "sed -i 's/{environment_tabs}/${config_loader.UI_CONFIG.environment_tabs}/g' ./src/environments/environment.oss.ts" - + def envFile = readFile('./src/environments/environment.oss.ts'); + echo "displaying env file :" echo "$envFile"; } } diff --git a/jazz-ui/src/app/pages/environment-deployment/env-deployments-section.component.ts b/jazz-ui/src/app/pages/environment-deployment/env-deployments-section.component.ts index 8fb3e20cad..56ce12b18c 100644 --- a/jazz-ui/src/app/pages/environment-deployment/env-deployments-section.component.ts +++ b/jazz-ui/src/app/pages/environment-deployment/env-deployments-section.component.ts @@ -7,7 +7,7 @@ import { Filter } from '../../secondary-components/jazz-table/jazz-filter'; import { Sort } from '../../secondary-components/jazz-table/jazz-table-sort'; import { ToasterService } from 'angular2-toaster'; declare var $:any; -import { environment } from './../../../environments/environment.internal'; +import { environment } from './../../../environments/environment'; import { environment as env_internal } from './../../../environments/environment.internal'; @@ -457,8 +457,7 @@ export class EnvDeploymentsSectionComponent implements OnInit { window.open(url, '_blank'); } - ngOnInit() { - + ngOnInit() { } paginatePage(currentlyActivePage){ @@ -571,7 +570,7 @@ export class EnvDeploymentsSectionComponent implements OnInit { this.paginatePage(this.currentlyActive); } - ngOnChanges(x:any) { + ngOnChanges(x:any) { this.envObj = this.cache.get('currentEnv'); this.status_val = parseInt(status[this.envObj.status]); @@ -619,13 +618,11 @@ toast_pop(error,oops,errorMessage) rebuild(){ this.rowclick = false; - this.http.post('/jazz/deployments/'+this.rebuild_id+'/re-build').subscribe( + var rebuild_url = '/jazz/deployments/'; + this.http.post(rebuild_url+this.rebuild_id+'/re-build').subscribe( (response) => { - let successMessage = this.toastmessage.successMessage(response, "retryDeploy"); - - this.toast_pop('success',"",successMessage+this.service.name); - + this.toast_pop('success',"",successMessage+this.service.name); }, (error) => { let errorMessage = this.toastmessage.errorMessage(error, "updateObj"); diff --git a/jazz-ui/src/app/pages/environment-detail/environment-detail.component.html b/jazz-ui/src/app/pages/environment-detail/environment-detail.component.html index c2f34e524e..c0f91dadfd 100644 --- a/jazz-ui/src/app/pages/environment-detail/environment-detail.component.html +++ b/jazz-ui/src/app/pages/environment-detail/environment-detail.component.html @@ -2,7 +2,6 @@
-
diff --git a/jazz-ui/src/app/pages/service-overview/service-overview.component.ts b/jazz-ui/src/app/pages/service-overview/service-overview.component.ts index 642180fd0b..e38abd2eff 100644 --- a/jazz-ui/src/app/pages/service-overview/service-overview.component.ts +++ b/jazz-ui/src/app/pages/service-overview/service-overview.component.ts @@ -621,6 +621,7 @@ export class ServiceOverviewComponent implements OnInit { friendly_name: this.friendlist } } + if (this.Environments.length == 0) { this.noSubEnv = true; } @@ -632,6 +633,8 @@ export class ServiceOverviewComponent implements OnInit { } this.cache.set('envList', this.list); + + } sortEnvArr() { diff --git a/jazz-ui/src/app/pages/services/services.component.html b/jazz-ui/src/app/pages/services/services.component.html index a394985208..0b728739f1 100644 --- a/jazz-ui/src/app/pages/services/services.component.html +++ b/jazz-ui/src/app/pages/services/services.component.html @@ -2,8 +2,6 @@
- -