Skip to content

Commit

Permalink
Deploy app on s3gw (#368)
Browse files Browse the repository at this point in the history
* Initial commit for enabling s3gw app deployment - mainly cleanup

  * new S3_STORE_TYPE env introduced:
     - supported values are: s3gw, s3
     - if not set minio is installed
     - if unsupported value is provided minio is installed

  * TBD:
     - reenable video in cypress.config.ts
     - remove it.skip from installation.spec.ts
     - remove comment // cy.reload() from functions.ts epinioInstall function
     - NEW S3GW WORKFLOW - try to enable only app deployment by using GREP
     - existing rancher workflows should work as before

* Rancher-UI-1-Chrome added job for deploying app on s3gw

* fix tag

* fix indent
  • Loading branch information
thehejik authored Aug 21, 2023
1 parent ea67a87 commit af45186
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 33 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/master_rancher_ui_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ on:
description: Runner on which to execute tests
required: true
type: string
grep_test_by_tag:
description: Grep tags. For multiple selection separate with spaces
required: false
type: string
default: ''
s3_store_type:
description: Select s3Storage type for installation (s3gw, s3, <none> = minio)
required: false
type: string
default: ''

jobs:
installation:
Expand Down Expand Up @@ -98,6 +108,7 @@ jobs:
S3_KEY_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SYSTEM_DOMAIN: ${{ needs.installation.outputs.MY_IP }}.omg.howdoi.website
UI: rancher
S3_STORE_TYPE: ${{ inputs.s3_store_type }}
# EXTRAENV_NAME: SESSION_KEY
# EXTRAENV_VALUE: 12345
options: --add-host ${{ needs.installation.outputs.MY_HOSTNAME }}:${{ needs.installation.outputs.MY_IP }} --ipc=host ${{ inputs.docker_options }}
Expand Down Expand Up @@ -209,6 +220,7 @@ jobs:
SYSTEM_DOMAIN: ${{ needs.installation.outputs.MY_IP }}.omg.howdoi.website
# set UI value to something else than 'rancher'
UI: epinio-rancher
GREPTAGS: ${{ inputs.grep_test_by_tag }}
options: --add-host ${{ needs.installation.outputs.MY_HOSTNAME }}:${{ needs.installation.outputs.MY_IP }} --ipc=host ${{ inputs.docker_options }}
steps:
- name: Cypress run
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/scenario_1_chrome_rancher_ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@ jobs:
cypress_test: menu.spec.ts
runner: ui-e2e-0
secrets: inherit

rancher-chrome-s3gw:
# Epinio installation with s3gw and with simple app deployment '@appl-1' test only
# It should be triggered on different runner than the other job to speed it up
uses: ./.github/workflows/master_rancher_ui_workflow.yml
with:
browser: chrome
cypress_image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
cypress_install_test: installation.spec.ts
cypress_test: applications.spec.ts
grep_test_by_tag: '@appl-1'
s3_store_type: s3gw
runner: ui-e2e
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ package-lock.json
cypress/videos/*
cypress/screenshots/*
cypress/downloads/*
mochawesome-report/*
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defineConfig } from 'cypress'
export default defineConfig({
viewportWidth: 1314,
viewportHeight: 954,
// video: false,
defaultCommandTimeout: 10000,
pageLoadTimeout:30000,
// numTestsKeptInMemory:25,
Expand Down
18 changes: 3 additions & 15 deletions cypress/e2e/unit_tests/installation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,19 @@ describe('Epinio installation testing', () => {
}
});

it('Install Epinio with s3gw, check ingress over URL and uninstall it', () => {
if (Cypress.env('experimental_chart_branch') != null) {
cy.epinioInstall({ s3: false, s3gw: true, extRegistry: false, namespace: 'None' });
}
else {
// Boolean must be forced to false otherwise code is failing
cy.epinioInstall({ s3: false, s3gw: true, extRegistry: false });
}
cy.checkEpinioInstallationRancher();
cy.visit('/c/local/explorer#cluster-events');
cy.epinioUninstall();
});

it('Install Epinio', () => {
if (Cypress.env('experimental_chart_branch') != null) {
cy.epinioInstall({ s3: false, extRegistry: false, namespace: 'None' });
cy.epinioInstall({ s3Storage: Cypress.env('s3Storage'), extRegistry: false, namespace: 'None' });
}
else {
// Boolean must be forced to false otherwise code is failing
cy.epinioInstall({ s3: false, extRegistry: false });
cy.epinioInstall({ s3Storage: Cypress.env('s3Storage'), extRegistry: false });
}
});

it('Verify Epinio over ingress URL', () => {
cy.checkEpinioInstallationRancher();
cy.visit('/c/local/explorer#cluster-events');
});

});
1 change: 1 addition & 0 deletions cypress/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions)
config.env.system_domain = process.env.SYSTEM_DOMAIN;
config.env.cors = process.env.CORS;
config.env.cache_session = process.env.CACHE_SESSION || false;
config.env.s3Storage = process.env.S3_STORE_TYPE;
config.env.external_reg_username = process.env.EXT_REG_USER;
config.env.external_reg_password = process.env.EXT_REG_PASSWORD;
config.env.s3_key_id = process.env.S3_KEY_ID;
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ declare global {
allowRancherPreReleaseVersions(): Chainable<Element>;
addHelmRepo(repoName: string, repoUrl: string, repoType?: string, branchName?: string,): Chainable<Element>;
removeHelmRepo(repoName?: string,): Chainable<Element>;
epinioInstall(s3?: boolean, s3gw?: boolean, extRegistry?: boolean, namespace?: string): Chainable<Element>;
epinioInstall(s3Storage?: string, extRegistry?: boolean, namespace?: string): Chainable<Element>;
createService(serviceName: string, catalogType: string): Chainable<Element>;
bindServiceFromSevicesPage(appName: string, serviceName: string, bindingOption?: string): Chainable<Element>;
deleteService(serviceName: string): Chainable<Element>;
Expand Down
37 changes: 20 additions & 17 deletions cypress/support/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ Cypress.Commands.add('addHelmRepo', ({ repoName, repoUrl, repoType, branchName =
});

// Install Epinio via Helm
Cypress.Commands.add('epinioInstall', ({ s3, s3gw = false, extRegistry, namespace = 'epinio-install' }) => {
Cypress.Commands.add('epinioInstall', ({ s3Storage, extRegistry, namespace = 'epinio-install' }) => {
cy.clickClusterMenu(['Apps', 'Charts']);

// Make sure we are in the chart screen (test failed here before)
Expand All @@ -1234,7 +1234,7 @@ Cypress.Commands.add('epinioInstall', ({ s3, s3gw = false, extRegistry, namespac
cy.get('#all_user', { timeout: 2000 }).contains('Only User Namespaces').should('be.visible').click();
// Close the namespaces dropdown
cy.get('.top > .ns-filter > .ns-dropdown.ns-open').click({ force: true });
// Reload to ensure installed apps are refreshed
// Reload to ensure installed apps are refreshed
cy.reload()

cy.get('a[href="/dashboard/c/local/apps/catalog.cattle.io.app"] > span.count', {timeout: 20000}).then(($el) => {
Expand Down Expand Up @@ -1281,21 +1281,24 @@ Cypress.Commands.add('epinioInstall', ({ s3, s3gw = false, extRegistry, namespac
cy.typeValue({label: 'External registry namespace', value: Cypress.env('external_reg_username'), log: false});
}

if (s3gw == true) {
cy.contains('a', 'S3 storage').click();
cy.contains('Install Minio').click();
cy.contains('Install s3gw').should('be.visible').click();
};

// Configure s3 storage
if (s3 === true) {
cy.contains('a', 'External S3 storage').click();
cy.contains('Use an external s3 storage').click();
cy.typeValue({label: 'S3 endpoint', value: 's3.amazonaws.com'});
cy.typeValue({label: 'S3 access key id', value: Cypress.env('s3_key_id'), log: false});
cy.typeValue({label: 'S3 access key secret', value: Cypress.env('s3_key_secret'), log: false});
cy.typeValue({label: 'S3 bucket', value: 'epinio-ci'});
cy.contains('S3 use SSL').click();
switch (s3Storage) {
case 's3gw':
cy.contains('a', 'S3 storage').click();
cy.contains('Install Minio').click();
cy.contains('Install s3gw').should('be.visible').click();
break;
case 's3':
// Configure external AWS S3 storage
cy.contains('a', 'S3 storage').click();
cy.contains('Install Minio').click();
cy.typeValue({label: 'S3 endpoint', value: 's3.amazonaws.com'});
cy.typeValue({label: 'S3 access key id', value: Cypress.env('s3_key_id'), log: false});
cy.typeValue({label: 'S3 access key secret', value: Cypress.env('s3_key_secret'), log: false});
cy.typeValue({label: 'S3 bucket', value: 'epinio-ci'});
cy.contains('S3 use SSL').click();
break;
default:
cy.log('Using default s3Storage (Minio)');
}

// Add ExtraEnv values on bottom of values yaml if present, careful here, editor does indentation
Expand Down

0 comments on commit af45186

Please sign in to comment.