Skip to content

Commit

Permalink
Merge branch 'release/v1.21.5-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Wolfes authored and cesmarvin committed Jan 19, 2022
2 parents 513385e + c1cc776 commit eb40877
Show file tree
Hide file tree
Showing 18 changed files with 5,180 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v1.21.5-1] - 2022-01-19
### Changed
- Add integration tests for custom static HTML page #51
- Upgrade to nginx 1.21.5; #51

## [v1.17.10-9] - 2021-11-22
### Changed
- update warp menu to version 1.3.0

## [v1.17.10-8] - 2021-11-02

### Changed
- The script to append the warp menu to each page is now hosted instead of inline (#49)
- Use logging/root key
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM registry.cloudogu.com/official/base:3.11.6-3 as builder
LABEL maintainer="michael.behlendorf@cloudogu.com"
LABEL maintainer="hello@cloudogu.com"

# dockerfile is based on https://github.com/dockerfile/nginx and https://github.com/bellycard/docker-loadbalancer

ENV NGINX_VERSION 1.17.10
ENV NGINX_TAR_SHA256="a9aa73f19c352a6b166d78e2a664bb3ef1295bbe6d3cc5aa7404bd4664ab4b83"
ENV NGINX_VERSION 1.21.5
ENV NGINX_TAR_SHA256="b20f3bf533a518a6f0f3a7967dfeed872d268d31e4cc121a0001329602ddcfbb"

COPY nginx-build /
RUN set -x \
Expand All @@ -22,7 +22,7 @@ RUN set -x \
FROM registry.cloudogu.com/official/base:3.12.4-1
LABEL maintainer="[email protected]" \
NAME="official/nginx" \
VERSION="1.17.10-9"
VERSION="1.21.5-1"

ENV CES_CONFD_VERSION=0.5.1 \
CES_CONFD_TAR_SHA256="f8776bc473beeacda8ff502861906bb9ab6eeda365513290116697cc6f68eee8" \
Expand Down
42 changes: 40 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ node('vagrant') {
// Keep only the last x builds to preserve space
buildDiscarder(logRotator(numToKeepStr: '10')),
// Don't run concurrent builds for a branch, because they use the same workspace directory
disableConcurrentBuilds()
disableConcurrentBuilds(),
// Parameter to activate dogu upgrade test on demand
parameters([
booleanParam(defaultValue: true, description: 'Enables cypress to record video of the integration tests.', name: 'EnableVideoRecording'),
booleanParam(defaultValue: true, description: 'Enables cypress to take screenshots of failing integration tests.', name: 'EnableScreenshotRecording'),
booleanParam(defaultValue: false, description: 'Test dogu upgrade from latest release or optionally from defined version below', name: 'TestDoguUpgrade'),
string(defaultValue: '', description: 'Old Dogu version for the upgrade test (optional; e.g. 3.23.0-1)', name: 'OldDoguVersionForUpgradeTest')
])
])

EcoSystem ecoSystem = new EcoSystem(this, "gcloud-ces-operations-internal-packer", "jenkins-gcloud-ces-operations-internal")
Expand All @@ -30,7 +37,7 @@ node('vagrant') {
}

stage('Shellcheck'){
shellCheck()
shellCheck('./resources/startup.sh ./nginx-build/build.sh')
}

try {
Expand All @@ -48,10 +55,41 @@ node('vagrant') {
ecoSystem.build("/dogu")
}

stage('Prepare Static HTML Config') {
ecoSystem.vagrant.ssh "sudo cp /dogu/integrationTests/privacy_policies.html /var/lib/ces/nginx/volumes/customhtml/"
ecoSystem.vagrant.ssh '''etcdctl set config/nginx/externals/privacy_policies '{\\"DisplayName\\":\\"Privacy Policies\\",\\"Description\\":\\"Contains information about the privacy policies enforced by our company\\",\\"Category\\":\\"Information\\",\\"URL\\":\\"/static/privacy_policies.html\\"}' '''
}

stage('Verify') {
ecoSystem.verify("/dogu")
}

stage('Integration tests') {
ecoSystem.runCypressIntegrationTests([cypressImage : "cypress/included:8.6.0",
enableVideo : params.EnableVideoRecording,
enableScreenshots: params.EnableScreenshotRecording])
}

if (params.TestDoguUpgrade != null && params.TestDoguUpgrade) {
stage('Upgrade dogu') {
// Remove new dogu that has been built and tested above
ecoSystem.purgeDogu(doguName)

if (params.OldDoguVersionForUpgradeTest != '' && !params.OldDoguVersionForUpgradeTest.contains('v')) {
println "Installing user defined version of dogu: " + params.OldDoguVersionForUpgradeTest
ecoSystem.installDogu("testing/" + doguName + " " + params.OldDoguVersionForUpgradeTest)
} else {
println "Installing latest released version of dogu..."
ecoSystem.installDogu("testing/" + doguName)
}
ecoSystem.startDogu(doguName)
ecoSystem.waitForDogu(doguName)
ecoSystem.upgradeDogu(ecoSystem)

// Wait for upgraded dogu to get healthy
ecoSystem.waitForDogu(doguName)
}
}
if (gitflow.isReleaseBranch()) {
String releaseVersion = git.getSimpleBranchName();

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ It is possible to deliver HTML content pages via the nginx dogu and navigate to
</body>
</html>
```
1) Save the HTML site as `privacy-policies.html` in the volume `/var/lib/ces/nginx/volumes/customhtml/`. Note: You can store all your HTML files in this volume. After restarting the nginx dogu the website should be accessible via `fqdn/static/privacy-policies.html`.
1) Save the HTML site as `privacy_policies.html` in the volume `/var/lib/ces/nginx/volumes/customhtml/`. Note: You can store all your HTML files in this volume. After restarting the nginx dogu the website should be accessible via `fqdn/static/privacy-policies.html`.
2) For every link we want to show in the warpmenu we need to create an etcdctl key in the form of `etcdctl /config/nginx/externals/<websitename>`. For our example page, we create the following key: `/config/nginx/externals/privacy_policies`. The value for the key needs to be a JSON object containing the following information:
```
{
Expand Down
9 changes: 9 additions & 0 deletions docs/dev/integration_tests_de.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Aufsetzen der Integrations Tests

Die Integration Tests, welche sich unter integrationTests/ befinden, können wie folgt ausgeführt werden:

```bash
cd integrationTests
yarn install
yarn cypress open
```
9 changes: 9 additions & 0 deletions docs/dev/integration_tests_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Setting up the integration tests

The integration tests, which are located under integrationTests/, can be executed as follows:

```bash
cd integrationTests
yarn install
yarn cypress open
```
7 changes: 5 additions & 2 deletions dogu.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Name": "official/nginx",
"Version": "1.17.10-9",
"Version": "1.21.5-1",
"DisplayName": "Nginx",
"Description": "Nginx WebServer.",
"Logo": "https://cloudogu.com/images/dogus/nginx.png",
Expand All @@ -13,7 +13,10 @@
"Url": "http://nginx.org/",
"Image": "registry.cloudogu.com/official/nginx",
"Dependencies": [
"registrator"
{
"type": "dogu",
"name": "registrator"
}
],
"Configuration": [
{
Expand Down
1 change: 1 addition & 0 deletions integrationTests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 11 additions & 0 deletions integrationTests/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"baseUrl": "https://192.168.56.2",
"env": {
"casPath": "/cas",
"nameOfCustomPageLinkInWarpMenu": "Privacy Policies",
"customHTMLPath": "/static/privacy_policies.html"
},
"videoCompression": false,
"nonGlobalStepBaseDir": false,
"experimentalSessionSupport": true
}
10 changes: 10 additions & 0 deletions integrationTests/cypress/integration/nginx_1_custom_HTML.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Feature: Searches for the custom HTML page

Scenario: opening the warp menu and looking for the link of the custom HTML page
When the user opens the always existing cas ui
Then the user opens the warp menu
Then the user checks link corresponding to the custom page

Scenario: entering the ressource URL into browser and opening the static custom HTML page
When the user requests the static custom HTML page
Then a static HTML custom page gets displayed
4 changes: 4 additions & 0 deletions integrationTests/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}
25 changes: 25 additions & 0 deletions integrationTests/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions integrationTests/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
18 changes: 18 additions & 0 deletions integrationTests/cypress/support/step_definitions/then.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const {
Then
} = require("cypress-cucumber-preprocessor/steps");

Then(/^the user opens the warp menu$/, function () {
cy.get('*[class^=" warp-menu-column-toggle"]').children('*[id^="warp-menu-warpbtn"]').click();
});

Then(/^the user checks link corresponding to the custom page$/, function () {
cy.get('*[class^=" warp-menu-shift-container"]')
.children('*[class^=" warp-menu-category-list"]')
.contains(Cypress.env('nameOfCustomPageLinkInWarpMenu'))
.should('have.attr', 'target', '_blank');
});

Then("a static HTML custom page gets displayed", function () {
cy.visit(Cypress.config().baseUrl + Cypress.env('customHTMLPath'));
});
11 changes: 11 additions & 0 deletions integrationTests/cypress/support/step_definitions/when.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const {
When
} = require("cypress-cucumber-preprocessor/steps");

When(/^the user opens the always existing cas ui$/, function () {
cy.visit(Cypress.config().baseUrl + Cypress.env('casPath'));
});

When(/^the user requests the static custom HTML page$/, function () {
cy.request(Cypress.env('customHTMLPath'));
});
6 changes: 6 additions & 0 deletions integrationTests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"devDependencies": {
"cypress": "8.6.0",
"cypress-cucumber-preprocessor": "4.1.0"
}
}
9 changes: 9 additions & 0 deletions integrationTests/privacy_policies.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>Privacy Policy</title>
</head>
<body>
<h1>Private Data We Receive And Collect</h1>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</body>
</html>
Loading

0 comments on commit eb40877

Please sign in to comment.