-
Notifications
You must be signed in to change notification settings - Fork 33
SonarQube Maintenance (LTS update, DB update, SAML setup, Helm migration) #1267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fb0e8aa
Update SonarQube
BraisVQ d67aa06
Update makefile
BraisVQ bd17426
make use of envsubst to prepare helm values
BraisVQ 8be0424
update tests, modify NOTES
BraisVQ e01b4ad
Update Docs for SonarQube
BraisVQ c81dfe0
set sonarqube user
BraisVQ 7e97398
Changelog and fix sonarqube tests
BraisVQ 7f46065
fix values typo, set chart version
BraisVQ 4f7a9c8
migration from tailor to helm
BraisVQ a36316c
udpate docs
BraisVQ 099c685
use rsync instead of cp, added download progress option
BraisVQ 08bd231
Updated backup script, added backup PVC for postgreSQL
BraisVQ 376bdff
Added end line
BraisVQ ec62855
update docs typo, removed anotations
BraisVQ 70f25d7
sightly modification of documentation
BraisVQ 924e0fa
adjust makefile with modifications on sonarqube backup script
BraisVQ 41962d6
add echo after SonarQube build, added Sonarqube Dockerhub URL to conf…
BraisVQ 7f4b897
Update README.md
BraisVQ 03cc443
make secret lowercase
BraisVQ 2fd8735
added migration script for auth provider and document it
BraisVQ b3dbfc1
added end line
BraisVQ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| = Migrating from Tailor to Helm | ||
|
|
||
| Tailor has been developed for OpenShift 3.11. Back in the days, Helm 2 required the use of a privileged Tiller service and did not work well with OpenShift-specific resources. With Helm 3 and OpenShift 4, this situation has changed. | ||
|
|
||
| While Tailor also works in an OpenShift 4 cluster, OpenShift has integrated Helm into its product, and Helm has a huge and growing community. Therefore, it is recommended to use Helm instead of Tailor in an OpenShift 4 cluster. | ||
|
|
||
| Tailor is based on OpenShift templates, which define the Kubernetes resources to apply. Helm uses a different templating language / engine, but in the end the templates also describe Kubernetes resources. Therefore, migration effort is relatively low as one only needs to change the syntax of the definition, not the definition itself. Further, there are differences between the CLI of the two tools and not all features of Tailor are available in Helm and vice-versa. Once migration to Helm is complete, it is also recommended to look at the best practices in the Helm community and adopt these. | ||
|
|
||
| This document will describe how to adopt resources deployed using Tailor into a Helm release for OpenDevStack installation. | ||
|
|
||
| == Templates preparation | ||
|
|
||
| There are basically two options how to approach this: you can either adopt your existing OpenShift resources to chart templates, or you can start a clean installation. | ||
| Once the templates have been made ready, you can continue the installation/update following the normal process | ||
|
|
||
| === Option 1: Adopting OpenShift resources | ||
|
|
||
| In order to adopt the resources into a Helm release you can use the following script https://github.com/opendevstack/ods-core/blob/master/scripts/tailor2helm.sh | ||
|
|
||
| === Option 2: Clean Installation | ||
|
|
||
| In this case you will need to remove all existing resources for the component that has been previously deployed using Tailor, you can check existing resources like this: | ||
|
|
||
| [source,sh] | ||
| ---- | ||
| oc -n ods get all -l app=foo-bar | ||
| ---- | ||
|
|
||
| == Sources | ||
|
|
||
| Check more information about migration from tailor to helm and their differences in https://github.com/opendevstack/tailor/wiki/Migrating-from-Tailor-to-Helm | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| #!/usr/bin/env bash | ||
| set -ue | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| ODS_CORE_DIR=${SCRIPT_DIR%/*} | ||
| ODS_CONFIGURATION_DIR="${ODS_CORE_DIR}/../ods-configuration" | ||
|
|
||
| echo_done(){ | ||
| echo -e "\033[92mDONE\033[39m: $1" | ||
| } | ||
|
|
||
| echo_warn(){ | ||
| echo -e "\033[93mWARN\033[39m: $1" | ||
| } | ||
|
|
||
| echo_error(){ | ||
| echo -e "\033[31mERROR\033[39m: $1" | ||
| } | ||
|
|
||
| echo_info(){ | ||
| echo -e "\033[94mINFO\033[39m: $1" | ||
| } | ||
|
|
||
|
|
||
| SONARQUBE_URL="" | ||
| SONAR_ADMIN_USERNAME="" | ||
| SONAR_ADMIN_PASSWORD="" | ||
| INSECURE="" | ||
|
|
||
| function usage { | ||
| printf "Migrate SonarQube users from Atlassian Crowd provider to Saml provider.\n\n" | ||
| printf "This script will ask interactively for parameters if not in ods-configuraion.\n" | ||
| printf "However, you can also pass them directly. Usage:\n\n" | ||
| printf "\t-h|--help\t\tPrint usage\n" | ||
| printf "\t-v|--verbose\t\tEnable verbose mode\n" | ||
| printf "\t-i|--insecure\t\tAllow insecure server connections when using SSL\n" | ||
| printf "\n" | ||
| printf "\t-s|--sonarqube\t\tSonarQube URL, e.g. 'https://sonarqube.example.com'\n" | ||
| printf "\t-u|--admin-user\tAdmin user\n" | ||
| printf "\t-p|--admin-password\tAdmin password\n" | ||
| } | ||
|
|
||
| while [[ "$#" -gt 0 ]]; do | ||
| case $1 in | ||
|
|
||
| -v|--verbose) set -x;; | ||
|
|
||
| -h|--help) usage; exit 0;; | ||
|
|
||
| -i|--insecure) INSECURE="--insecure";; | ||
|
|
||
| -p|--admin-password) SONAR_ADMIN_PASSWORD="$2"; shift;; | ||
| -p=*|--admin-password=*) SONAR_ADMIN_PASSWORD="${1#*=}";; | ||
|
|
||
| -u|--admin-user) SONAR_ADMIN_USERNAME="$2"; shift;; | ||
| -u=*|--admin-user=*) SONAR_ADMIN_USERNAME="${1#*=}";; | ||
|
|
||
| -s|--sonarqube) SONARQUBE_URL="$2"; shift;; | ||
| -s=*|--sonarqube=*) SONARQUBE_URL="${1#*=}";; | ||
|
|
||
| *) echo_error "Unknown parameter passed: $1"; exit 1;; | ||
| esac; shift; done | ||
|
|
||
| if [ -f "${ODS_CONFIGURATION_DIR}/ods-core.env" ]; then | ||
|
|
||
| if [ -z "${SONARQUBE_URL}" ]; then | ||
| SONARQUBE_URL=$(../scripts/get-config-param.sh SONARQUBE_URL) | ||
| fi | ||
|
|
||
| if [ -z "${SONAR_ADMIN_USERNAME}" ]; then | ||
| SONAR_ADMIN_USERNAME=$(../scripts/get-config-param.sh SONAR_ADMIN_USERNAME) | ||
| fi | ||
|
|
||
| if [ -z "${SONAR_ADMIN_PASSWORD}" ]; then | ||
| SONAR_ADMIN_PASSWORD=$(../scripts/get-config-param.sh SONAR_ADMIN_PASSWORD_B64 | base64 -d) | ||
| fi | ||
|
|
||
| fi | ||
|
|
||
| Email_list=$( curl ${INSECURE} ${SONAR_URL}/api/users/search -u admin:${SONAR_ADMIN_TOKEN} | jq .users | grep login | grep @ | tr -d '"' | tr -d "," | cut -f2 -d ":" ) | ||
| email_list_array=($Email_list) | ||
|
|
||
| for email in "${email_list_array[@]}" | ||
| do | ||
| curl ${INSECURE} -X POST -sSf -u admin:${SONAR_ADMIN_TOKEN} "${SONAR_URL}/api/users/update_identity_provider?newExternalProvider=saml&login=${email}" > /dev/null | ||
| echo "User ${email} migrated to Saml" | ||
| done |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.