diff --git a/.github/workflows/build-centraldashboard.yml b/.github/workflows/build-centraldashboard.yml index 2260579e8b8..22fb6304d9a 100644 --- a/.github/workflows/build-centraldashboard.yml +++ b/.github/workflows/build-centraldashboard.yml @@ -20,6 +20,7 @@ env: CLUSTER_RESOURCE_GROUP: k8s-cancentral-01-covid-aks TRIVY_VERSION: "v0.43.1" SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + HADOLINT_VERSION: "2.12.0" jobs: build-push: @@ -73,14 +74,21 @@ jobs: trivy image localhost:5000/kubeflow/centraldashboard-aaw2:${{ github.sha }} --exit-code 1 --timeout=20m --security-checks vuln --severity CRITICAL # Run Dockle - - name: Run dockle - uses: goodwithtech/dockle-action@main - with: - image: localhost:5000/kubeflow/centraldashboard-aaw2:${{ github.sha }} - format: 'list' - exit-code: '0' - exit-level: 'fatal' - ignore: 'DKL-DI-0006' + # - name: Run dockle + # uses: goodwithtech/dockle-action@main + # with: + # image: localhost:5000/kubeflow/centraldashboard-aaw2:${{ github.sha }} + # format: 'list' + # exit-code: '0' + # exit-level: 'fatal' + # ignore: 'DKL-DI-0006' + + # On hold to replace dockle + # - name: Run Hadolint + # run: | + # sudo curl -L https://github.com/hadolint/hadolint/releases/download/v${{ env.HADOLINT_VERSION }}/hadolint-Linux-x86_64 --output hadolint + # sudo chmod +x hadolint + # ./hadolint localhost:5000/kubeflow/centraldashboard-aaw2 --no-fail # Pushes if this is a push to master or an update to a PR that has auto-deploy label - name: Test if we should push to ACR diff --git a/components/centraldashboard/cypress/e2e/landing-page.cy.ts b/components/centraldashboard/cypress/e2e/landing-page.cy.ts index 79415e0c10a..c6d1f47b64f 100644 --- a/components/centraldashboard/cypress/e2e/landing-page.cy.ts +++ b/components/centraldashboard/cypress/e2e/landing-page.cy.ts @@ -23,6 +23,21 @@ describe('Landing Page', () => { cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > div > #emailDisplay').find('span').should('exist').and('have.text', 'user.name@statcan.gc.ca'); cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > div > #namespaceDisplay').find('span').should('exist').and('have.text', 'user-name'); }); + it('Email number should stay in namespace', ()=>{ + cy.intercept('GET', `/api/workgroup/exists`, { + "hasAuth":true, + "user":"user.name1@statcan.gc.ca", + "email": "user.name1@statcan.gc.ca", + "hasWorkgroup":false, + "registrationFlowAllowed": true, + "isAllowed": true + }).as('mockWorkgroupRequest'); + cy.visit('/'); + + cy.wait(['@mockWorkgroupRequest', '@mockDashboardLinksRequest']); + cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > div > #emailDisplay').find('span').should('exist').and('have.text', 'user.name1@statcan.gc.ca'); + cy.get('main-page').shadow().find('landing-page').shadow().find('#MainCard > neon-animatable > div > #namespaceDisplay').find('span').should('exist').and('have.text', 'user-name1'); + }); it('should create new namespace and notebook', ()=>{ //Not asserting landing page username and namespace values since it's asserted in the test above diff --git a/components/centraldashboard/public/assets/i18n/languages.json b/components/centraldashboard/public/assets/i18n/languages.json index 5802f676838..b833db7cfc8 100644 --- a/components/centraldashboard/public/assets/i18n/languages.json +++ b/components/centraldashboard/public/assets/i18n/languages.json @@ -74,7 +74,6 @@ "landingPage.errCreateNS": "An error occured while creating the workspace", "landingPage.errGetNS": "An error occured while trying to retrieve the workspace", "landingPage.errCreateDefaultNotebook": "An error occured while trying to create the default notebook", - "landingPage.errGeneral": "An unexpected error occured, details available in English:", "blockedUserPage.text": "The dev environment is only accessible to developers.", "notebookDefaultCard.goto": "Go to Notebooks", "notebookDefaultCard.create": "Create", @@ -222,7 +221,6 @@ "landingPage.errCreateNS": "Une erreur s'est produite lors de la création de l'espace de travail", "landingPage.errGetNS": "Une erreur s'est produite lors de la tentative de récupération de l'espace de travail", "landingPage.errCreateDefaultNotebook": "Une erreur s'est produite lors de la tentative de création du notebook par défaut", - "landingPage.errGeneral": "Une erreur inattendue s'est produite, détails disponibles en anglais :", "blockedUserPage.text": "L'environment Dev est seulement pour les développeurs.", "registrationPage.btnNext": "Suivant", "registrationPage.btnStartSetup": "Commencer", diff --git a/components/centraldashboard/public/components/landing-page.js b/components/centraldashboard/public/components/landing-page.js index 0623c1f249e..3304e16ce2f 100644 --- a/components/centraldashboard/public/components/landing-page.js +++ b/components/centraldashboard/public/components/landing-page.js @@ -42,10 +42,8 @@ export class LandingPage extends mixinBehaviors([AppLocalizeBehavior], utilities emailAddress: {type: String, observer: '_onEmailAddress'}, namespaceName: String, errorText: {type: String, value: ''}, - errorDetail: {type: String, value: ''}, flowComplete: {type: Boolean, value: false}, loading: {type: Boolean, value: false}, - showAPIText: {type: Boolean, value: false}, isStatcanEmail: {type: Boolean, value: false}, }; } @@ -67,41 +65,8 @@ export class LandingPage extends mixinBehaviors([AppLocalizeBehavior], utilities ns = ns .replace(/[^\w]|\./g, '-') .replace(/^-+|-+$|_/g, '') - .replace(/[0-9]/g, '') .toLowerCase(); - - this.getNamespaces(ns); - } - - async getNamespaces(ns) { - await fetch( - `/api/namespaces/`, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - } - ) - .then((res) => res.json()) - .then((data) => { - const namespaceNames = []; - data.forEach((element) => { - namespaceNames.push(element.metadata.name); - }); - let counter = 1; - // Remove any numbers at the end - const originalNs = ns.replace(/\d+/g, ''); - if (namespaceNames.includes(originalNs)) { - while (namespaceNames.includes(originalNs + counter)) { - counter++; - } - ns = originalNs + counter; - } - this.namespaceName = ns; - }).catch((e)=> { - this.showError('landingPage.errGeneral'); - this.errorDetail= e; - }); + this.namespaceName = ns; } logout() { @@ -119,17 +84,15 @@ export class LandingPage extends mixinBehaviors([AppLocalizeBehavior], utilities async handleMakeNamespace() { /* - * Poll for profile over a span of 20 seconds (every 300ms) - * Waits for the new profile to be available - * if still not there, let the user click next again! - */ + * Poll for profile over a span of 20 seconds (every 300ms* max 66 times) + * Waits for the new profile to be available + */ const success = await this.pollProfile(66, 300); if (success) this._successSetup(); // Create the default notebook - const APICreateDefault = this.$.CreateDefaultNotebook; - - APICreateDefault.generateRequest(); + const APICreateDefaultNotebook = this.$.CreateDefaultNotebook; + APICreateDefaultNotebook.generateRequest(); } async pollProfile(times, delay) { @@ -153,12 +116,10 @@ export class LandingPage extends mixinBehaviors([AppLocalizeBehavior], utilities showError(err) { this.loading = false; this.errorText = err; - this.errorDetail = ''; } closeError() { this.errorText = ''; - this.errorDetail = ''; } _onCreateNamespaceError() {