diff --git a/CHANGELOG.md b/CHANGELOG.md index b4357cb9c14cbaad49ef7a50cd23c4a343f1e748..4cd73902eaccbe2ff120d3617087f581f12e2962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,26 +1,33 @@ # Changelog -## 9.2.6-bb.8 - 2021-04-06 +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -Updated sonarqube image version to 8.7.1-community +--- +## [9.2.6-bb.9] - 2021-05-10 +### Changed +- Moved cypress testing to the new helm test structure. -## 9.2.6-bb.7 - 2021-03-31 +## [9.2.6-bb.8] - 2021-04-06 +### Update +- Updated sonarqube image version to 8.7.1-community -Adding Affinity documentation +## [9.2.6-bb.7] - 2021-03-31 +### Added +- Adding Affinity documentation -## 9.2.6-bb.6 - 2021-03-30 +## [9.2.6-bb.6] - 2021-03-30 Modified initContainer logic -## 9.2.6-bb.5 - 2021-03-22 +## [9.2.6-bb.5] - 2021-03-22 Fixed initContainer logic -## 9.2.6-bb.4 - 2021-03-22 +## [9.2.6-bb.4] - 2021-03-22 Adding ability to specify istio gateways and hosts in values file -## 9.2.6-bb.3 - 2021-03-16 +## [9.2.6-bb.3] - 2021-03-16 Plugins have been preinstalled into the container and made available at registry.dso.mil. InitContainers have also been pushed into registry.dso.mil until ironbank equivalents can be found. diff --git a/Dockerfile b/Dockerfile index 4ece7bf58849e7c6790372e750fff63114482934..671cc39833c8862559ae09df61c08876c8e4a402 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Start with the IronBank Image FROM registry1.dso.mil/ironbank/sonarsource/sonarqube/sonarqube8-community:8.7.1-community # Add needed Plugins -ADD https://github.com/dependency-check/dependency-check-sonar-plugin/releases/download/1.2.6/sonar-dependency-check-plugin-1.2.6.jar /opt/sonarqube/extensions/plugins/ +ADD https://github.com/dependency-check/dependency-check-sonar-plugin/releases/download/2.0.7/sonar-dependency-check-plugin-2.0.7.jar /opt/sonarqube/extensions/plugins/ ADD https://github.com/SonarOpenCommunity/sonar-cxx/releases/download/cxx-1.3.2/sonar-c-plugin-1.3.2.1853.jar /opt/sonarqube/extensions/plugins/ ADD https://github.com/SonarOpenCommunity/sonar-cxx/releases/download/cxx-1.3.2/sonar-cxx-plugin-1.3.2.1853.jar /opt/sonarqube/extensions/plugins/ ADD https://github.com/dmeiners88/sonarqube-prometheus-exporter/releases/download/v1.0.0-SNAPSHOT-2018-07-04/sonar-prometheus-exporter-1.0.0-SNAPSHOT.jar /opt/sonarqube/extensions/plugins/ diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 07f6ffbb3b23064e983c12f0e657077d52dc4350..592e43429b2cb8c178cbf053e9b3da72fb7a15fe 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: 8.7.1-community name: sonarqube description: SonarQube is an open sourced code quality scanning tool -version: 9.2.6-bb.8 +version: 9.2.6-bb.9 keywords: - coverage - security @@ -17,3 +17,7 @@ maintainers: email: rjkernick@gmail.com - name: tsiddique email: tsiddique@live.com +dependencies: + - name: bb-test-lib + version: "0.4.0" + repository: "oci://registry.dso.mil/platform-one/big-bang/pipeline-templates/pipeline-templates" diff --git a/chart/charts/bb-test-lib-0.4.0.tgz b/chart/charts/bb-test-lib-0.4.0.tgz new file mode 100644 index 0000000000000000000000000000000000000000..75be43576bcc47b2ea027059ec8ce1b94b9f5dcf Binary files /dev/null and b/chart/charts/bb-test-lib-0.4.0.tgz differ diff --git a/chart/charts/postgresql-8.6.4.tgz b/chart/charts/postgresql-8.6.4.tgz new file mode 100644 index 0000000000000000000000000000000000000000..026c6f5b4623da542858aab28e99f84620abf758 Binary files /dev/null and b/chart/charts/postgresql-8.6.4.tgz differ diff --git a/chart/charts/postgresql/.helmignore b/chart/deps/postgresql/.helmignore similarity index 100% rename from chart/charts/postgresql/.helmignore rename to chart/deps/postgresql/.helmignore diff --git a/chart/charts/postgresql/Chart.yaml b/chart/deps/postgresql/Chart.yaml similarity index 100% rename from chart/charts/postgresql/Chart.yaml rename to chart/deps/postgresql/Chart.yaml diff --git a/chart/charts/postgresql/README.md b/chart/deps/postgresql/README.md similarity index 100% rename from chart/charts/postgresql/README.md rename to chart/deps/postgresql/README.md diff --git a/chart/charts/postgresql/ci/default-values.yaml b/chart/deps/postgresql/ci/default-values.yaml similarity index 100% rename from chart/charts/postgresql/ci/default-values.yaml rename to chart/deps/postgresql/ci/default-values.yaml diff --git a/chart/charts/postgresql/ci/shmvolume-disabled-values.yaml b/chart/deps/postgresql/ci/shmvolume-disabled-values.yaml similarity index 100% rename from chart/charts/postgresql/ci/shmvolume-disabled-values.yaml rename to chart/deps/postgresql/ci/shmvolume-disabled-values.yaml diff --git a/chart/charts/postgresql/files/README.md b/chart/deps/postgresql/files/README.md similarity index 100% rename from chart/charts/postgresql/files/README.md rename to chart/deps/postgresql/files/README.md diff --git a/chart/charts/postgresql/files/conf.d/README.md b/chart/deps/postgresql/files/conf.d/README.md similarity index 100% rename from chart/charts/postgresql/files/conf.d/README.md rename to chart/deps/postgresql/files/conf.d/README.md diff --git a/chart/charts/postgresql/files/docker-entrypoint-initdb.d/README.md b/chart/deps/postgresql/files/docker-entrypoint-initdb.d/README.md similarity index 100% rename from chart/charts/postgresql/files/docker-entrypoint-initdb.d/README.md rename to chart/deps/postgresql/files/docker-entrypoint-initdb.d/README.md diff --git a/chart/charts/postgresql/templates/NOTES.txt b/chart/deps/postgresql/templates/NOTES.txt similarity index 100% rename from chart/charts/postgresql/templates/NOTES.txt rename to chart/deps/postgresql/templates/NOTES.txt diff --git a/chart/charts/postgresql/templates/_helpers.tpl b/chart/deps/postgresql/templates/_helpers.tpl similarity index 100% rename from chart/charts/postgresql/templates/_helpers.tpl rename to chart/deps/postgresql/templates/_helpers.tpl diff --git a/chart/charts/postgresql/templates/configmap.yaml b/chart/deps/postgresql/templates/configmap.yaml similarity index 100% rename from chart/charts/postgresql/templates/configmap.yaml rename to chart/deps/postgresql/templates/configmap.yaml diff --git a/chart/charts/postgresql/templates/extended-config-configmap.yaml b/chart/deps/postgresql/templates/extended-config-configmap.yaml similarity index 100% rename from chart/charts/postgresql/templates/extended-config-configmap.yaml rename to chart/deps/postgresql/templates/extended-config-configmap.yaml diff --git a/chart/charts/postgresql/templates/initialization-configmap.yaml b/chart/deps/postgresql/templates/initialization-configmap.yaml similarity index 100% rename from chart/charts/postgresql/templates/initialization-configmap.yaml rename to chart/deps/postgresql/templates/initialization-configmap.yaml diff --git a/chart/charts/postgresql/templates/metrics-configmap.yaml b/chart/deps/postgresql/templates/metrics-configmap.yaml similarity index 100% rename from chart/charts/postgresql/templates/metrics-configmap.yaml rename to chart/deps/postgresql/templates/metrics-configmap.yaml diff --git a/chart/charts/postgresql/templates/metrics-svc.yaml b/chart/deps/postgresql/templates/metrics-svc.yaml similarity index 100% rename from chart/charts/postgresql/templates/metrics-svc.yaml rename to chart/deps/postgresql/templates/metrics-svc.yaml diff --git a/chart/charts/postgresql/templates/networkpolicy.yaml b/chart/deps/postgresql/templates/networkpolicy.yaml similarity index 100% rename from chart/charts/postgresql/templates/networkpolicy.yaml rename to chart/deps/postgresql/templates/networkpolicy.yaml diff --git a/chart/charts/postgresql/templates/prometheusrule.yaml b/chart/deps/postgresql/templates/prometheusrule.yaml similarity index 100% rename from chart/charts/postgresql/templates/prometheusrule.yaml rename to chart/deps/postgresql/templates/prometheusrule.yaml diff --git a/chart/charts/postgresql/templates/secrets.yaml b/chart/deps/postgresql/templates/secrets.yaml similarity index 100% rename from chart/charts/postgresql/templates/secrets.yaml rename to chart/deps/postgresql/templates/secrets.yaml diff --git a/chart/charts/postgresql/templates/serviceaccount.yaml b/chart/deps/postgresql/templates/serviceaccount.yaml similarity index 100% rename from chart/charts/postgresql/templates/serviceaccount.yaml rename to chart/deps/postgresql/templates/serviceaccount.yaml diff --git a/chart/charts/postgresql/templates/servicemonitor.yaml b/chart/deps/postgresql/templates/servicemonitor.yaml similarity index 100% rename from chart/charts/postgresql/templates/servicemonitor.yaml rename to chart/deps/postgresql/templates/servicemonitor.yaml diff --git a/chart/charts/postgresql/templates/statefulset-slaves.yaml b/chart/deps/postgresql/templates/statefulset-slaves.yaml similarity index 100% rename from chart/charts/postgresql/templates/statefulset-slaves.yaml rename to chart/deps/postgresql/templates/statefulset-slaves.yaml diff --git a/chart/charts/postgresql/templates/statefulset.yaml b/chart/deps/postgresql/templates/statefulset.yaml similarity index 100% rename from chart/charts/postgresql/templates/statefulset.yaml rename to chart/deps/postgresql/templates/statefulset.yaml diff --git a/chart/charts/postgresql/templates/svc-headless.yaml b/chart/deps/postgresql/templates/svc-headless.yaml similarity index 100% rename from chart/charts/postgresql/templates/svc-headless.yaml rename to chart/deps/postgresql/templates/svc-headless.yaml diff --git a/chart/charts/postgresql/templates/svc-read.yaml b/chart/deps/postgresql/templates/svc-read.yaml similarity index 100% rename from chart/charts/postgresql/templates/svc-read.yaml rename to chart/deps/postgresql/templates/svc-read.yaml diff --git a/chart/charts/postgresql/templates/svc.yaml b/chart/deps/postgresql/templates/svc.yaml similarity index 100% rename from chart/charts/postgresql/templates/svc.yaml rename to chart/deps/postgresql/templates/svc.yaml diff --git a/chart/charts/postgresql/values-production.yaml b/chart/deps/postgresql/values-production.yaml similarity index 100% rename from chart/charts/postgresql/values-production.yaml rename to chart/deps/postgresql/values-production.yaml diff --git a/chart/charts/postgresql/values.schema.json b/chart/deps/postgresql/values.schema.json similarity index 100% rename from chart/charts/postgresql/values.schema.json rename to chart/deps/postgresql/values.schema.json diff --git a/chart/charts/postgresql/values.yaml b/chart/deps/postgresql/values.yaml similarity index 100% rename from chart/charts/postgresql/values.yaml rename to chart/deps/postgresql/values.yaml diff --git a/chart/requirements.lock b/chart/requirements.lock new file mode 100644 index 0000000000000000000000000000000000000000..df6e03a166dd1e0ca1fc10fa82dbf5767b823bc9 --- /dev/null +++ b/chart/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: file://./deps/postgresql + version: 8.6.4 +digest: sha256:ee20a56a481163f172694703dccf40e88ca9f8a5a4b1637f8dce3361f592aed2 +generated: "2021-05-07T13:46:34.5689816-06:00" diff --git a/chart/requirements.yaml b/chart/requirements.yaml index 8eea6bb3a10dcb5efd6c2fe8df072569d50c39d6..db53d78925e452e39dd827990828a133d7c2acb5 100644 --- a/chart/requirements.yaml +++ b/chart/requirements.yaml @@ -1,5 +1,5 @@ dependencies: - name: postgresql version: 8.6.4 - repository: file://charts/postgresql + repository: file://./deps/postgresql condition: postgresql.enabled diff --git a/chart/templates/tests/sonarqube-cypress-test.yaml b/chart/templates/tests/sonarqube-cypress-test.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cdc96355bb27c5ba37306a6e61a46e26419cd2f3 --- /dev/null +++ b/chart/templates/tests/sonarqube-cypress-test.yaml @@ -0,0 +1,19 @@ +{{- include "bb-test-lib.cypress-configmap.overrides" (list . "sonarqube-test.cypress-configmap") }} +{{- define "sonarqube-test.cypress-configmap" }} +metadata: + labels: + helm.sh/chart: {{ include "sonarqube.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: sonarqube +{{- end }} +--- +{{- include "bb-test-lib.cypress-runner.overrides" (list . "sonarqube-test.cypress-runner") -}} +{{- define "sonarqube-test.cypress-runner" -}} +metadata: + labels: + helm.sh/chart: {{ include "sonarqube.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: sonarqube +{{- end }} diff --git a/chart/templates/tests/sonarqube-test.yaml b/chart/templates/tests/sonarqube-test.yaml deleted file mode 100644 index 3f5b5ebc919f9034f2a4798a96e2d4b87411b0cc..0000000000000000000000000000000000000000 --- a/chart/templates/tests/sonarqube-test.yaml +++ /dev/null @@ -1,47 +0,0 @@ -{{- if .Values.tests.enabled -}} -apiVersion: v1 -kind: Pod -metadata: - name: "{{ .Release.Name }}-ui-test" - annotations: - "helm.sh/hook": test-success - labels: - app: {{ template "sonarqube.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - initContainers: - - name: "bats" - image: "registry.dso.mil/platform-one/big-bang/apps/developer-tools/sonarqube/bats:1.2.1" - imagePullPolicy: {{ .Values.image.pullPolicy }} - command: ["bash", "-c"] - args: - - |- - set -ex - cp -R /opt/bats /tools/bats/ - volumeMounts: - - mountPath: /tools - name: tools - containers: - - name: {{ .Release.Name }}-ui-test - image: {{ default "registry.dso.mil/platform-one/big-bang/apps/developer-tools/sonarqube/minideb-extras:latest" .Values.tests.image }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - command: [ - "/tools/bats/bin/bats", - "--tap", - "/tests/run.sh"] - volumeMounts: - - mountPath: /tests - name: tests - readOnly: true - - mountPath: /tools - name: tools - volumes: - - name: tests - configMap: - name: {{ template "sonarqube.fullname" . }}-tests - - name: tools - emptyDir: {{ toYaml .Values.emptyDir | nindent 6 }} - restartPolicy: Never -{{- end -}} diff --git a/chart/tests/cypress/cypress.json b/chart/tests/cypress/cypress.json new file mode 100644 index 0000000000000000000000000000000000000000..e36f98472bbfea7bfc965e1a081f0b002af04859 --- /dev/null +++ b/chart/tests/cypress/cypress.json @@ -0,0 +1,5 @@ +{ + "pluginsFile": false, + "supportFile": false, + "fixturesFolder": false +} diff --git a/chart/tests/cypress/sonarqube-health.spec.js b/chart/tests/cypress/sonarqube-health.spec.js new file mode 100644 index 0000000000000000000000000000000000000000..91dcead3d6ebac709bec13eaf891b59122fdd099 --- /dev/null +++ b/chart/tests/cypress/sonarqube-health.spec.js @@ -0,0 +1,20 @@ +// needs to be fixed +describe('Basic Sonarqube', function() { + it('Check Sonarqube is accessible', function() { + cy.visit(Cypress.env('url')) + cy.get('input[name="login"]').type(Cypress.env('user')) + cy.get('input[name="password"]').type(Cypress.env('password')) + cy.contains("Log in").click() + cy.contains('Update your password') + cy.get('input[name="old_password"]').type(Cypress.env('password')) + cy.get('input[name="password"]').type(Cypress.env('newpassword')) + cy.get('input[name="password_confirmation"]').type(Cypress.env('newpassword')) + cy.get('button[id="change-password"]').click() + cy.scrollTo('topRight') + cy.get('a[class="dropdown-toggle navbar-avatar"]').click() + cy.contains("My Account").click() + cy.contains("Security").click() + cy.get('input[class="input-large spacer-right"]').type('Test Token') + cy.get('button[class="button js-generate-token"]').click() + }) +}) diff --git a/chart/values.yaml b/chart/values.yaml index b04d80d211e8c7c9b55317d79b40f6a737a3e683..83a686e648cd2caf5d10f737ff0eb99795470b11 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -23,7 +23,8 @@ image: tag: 8.7.1-community-bb pullPolicy: IfNotPresent # If using a private repository, the name of the imagePullSecret to use - pullSecret: [] + pullSecret: private-registry + # Set security context for sonarqube pod securityContext: diff --git a/tests/cy-run.sh b/tests/cy-run.sh deleted file mode 100644 index 2df7a77796b123ada7ac4d0d357ac452e4fedebc..0000000000000000000000000000000000000000 --- a/tests/cy-run.sh +++ /dev/null @@ -1,16 +0,0 @@ - -#!/usr/bin/env bash -echo "Running Cypress e2e tests headlessly without copying files" - -# explanation of the "docker run" command line arguments -# -# -it = interactive terminal -# -v $PWD:/e2e = map current folder to /e2e inside the container -# -w /e2e = set working directy to /e2e -# $@ = pass any arguments to this script to the Cypress command -# like "./cy-run.sh --record" -# -# Docker image "cypress/included:3.2.0" has its entrypoint -# set to "cypress run" by default - -docker run -it -v $PWD:/e2e -w /e2e cypress/included:5.0.0 $@ diff --git a/tests/cypress.json b/tests/cypress.json deleted file mode 100644 index 9408b4cb5d49be31017d2a390fb6b613e22d9456..0000000000000000000000000000000000000000 --- a/tests/cypress.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - - "pluginsFile": false, - "supportFile": false, - "fixturesFolder": false, - "env": { - "sonarqube_url": "sonarqube.bigbang.dev", - "sonarqube_password": "admin", - "sonarqube_user": "admin" - } -} diff --git a/tests/cypress/integration/sonarqube-health.spec.js b/tests/cypress/integration/sonarqube-health.spec.js deleted file mode 100644 index 7e1c62ed9e84fdedb6a50bf17931ba94637d9095..0000000000000000000000000000000000000000 --- a/tests/cypress/integration/sonarqube-health.spec.js +++ /dev/null @@ -1,10 +0,0 @@ -// needs to be fixed -describe('Basic Sonarqube', function() { - it('Check Sonarqube is accessible', function() { - cy.visit(Cypress.env('sonarqube_url')) - cy.get('input[name="login"]').type(Cypress.env('sonarqube_user')) - cy.get('input[name="password"]').type(Cypress.env('sonarqube_password')) - cy.contains("Log in").click() - cy.contains('Update your password') - }) -}) diff --git a/tests/main-test-gateway.yaml b/tests/main-test-gateway.yaml deleted file mode 100644 index 298b582f3b3c8884a1c84dc77ab4846f8a63f531..0000000000000000000000000000000000000000 --- a/tests/main-test-gateway.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: networking.istio.io/v1beta1 -kind: Gateway -metadata: - annotations: - meta.helm.sh/release-name: istio-system-istio - meta.helm.sh/release-namespace: istio-system - creationTimestamp: "2020-12-08T01:19:38Z" - generation: 1 - labels: - app.kubernetes.io/managed-by: Helm - name: main - namespace: istio-system - resourceVersion: "1661" - selfLink: /apis/networking.istio.io/v1beta1/namespaces/istio-system/gateways/main - uid: 9cfaa8c6-744a-49b3-abc0-b3960153c9b2 -spec: - selector: - istio: ingressgateway - servers: - - hosts: - - '*' - port: - name: http - number: 80 - protocol: HTTP - tls: - httpsRedirect: true - - hosts: - - '*.bigbang.dev' - port: - name: https - number: 443 - protocol: HTTPS - tls: - credentialName: wildcard-cert - mode: SIMPLE diff --git a/tests/test-values.yml b/tests/test-values.yml index aaddc0cfbbe077fa397c2be1b467e11d09e6ff9a..ef111d128896ae1ffa35ee556f5513bdeebab418 100644 --- a/tests/test-values.yml +++ b/tests/test-values.yml @@ -1,5 +1,8 @@ -image: - pullSecret: private-registry-mil - -istio: - enabled: true +bbtests: + cypress: + artifacts: true + envs: + cypress_url: "http://sonarqube-sonarqube:9000" + cypress_user: "admin" + cypress_password: "admin" + cypress_newpassword: "new_admin_password"