-
Notifications
You must be signed in to change notification settings - Fork 24
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
Integration of the toolbox.sh script and associated unit tests to install the SonarQube development environment #62
Open
christopherlouet
wants to merge
16
commits into
green-code-initiative:main
Choose a base branch
from
christopherlouet:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
08b3e51
🔨 Initialize the toolbox.sh script to install the SonarQube developme…
christopherlouet edb4ea1
🔨 Initializing unit tests for bash scripts with pytest
christopherlouet 7790373
🔨 Add utils.sh script to launch toolbox commands
christopherlouet c682295
🔨 Added utils_bash.sh script to run unit tests and generate documenta…
christopherlouet cb55031
🔨 Added release functions and updated bash documentation
christopherlouet e2210cc
🔨 Update release function
christopherlouet 59a2b92
🔨 Update the pytest environment and add various fix
christopherlouet acc0891
🔨 Merge of release 1.6.2
christopherlouet 708c6d5
Merge branch 'main' into main
christopherlouet 96e76ae
🔨 Updated utils.sh to start a container with docker and java environm…
christopherlouet 85ff7b3
🔨 Added fixes to the toolbox.sh script and updated unit tests.
christopherlouet 2cb42db
🔨 Add a github action for Bash Tests
christopherlouet 6769ec0
🔨 Add condition for publishing image in github action
christopherlouet 02f6f5b
🔨 Added a patch to copy the jar file and updated toolbox.sh script pa…
christopherlouet c8cba33
🔨 Add SONAR_LOG_LEVEL_WEB environment variable
christopherlouet b7fec57
test toolbox
christopherlouet 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 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,6 @@ | ||
MAVEN_BUILDER_VERSION=3-openjdk-17-slim | ||
SONARQUBE_VERSION=10.6.0-community | ||
POSTGRES_VERSION=12 | ||
SONAR_LOG_LEVEL_WEB=INFO | ||
DOCKER_BUILDKIT=1 | ||
COMPOSE_DOCKER_CLI_BUILD=1 |
This file contains 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 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,49 @@ | ||
name: Bash Tests | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Setup Python | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.12' | ||
|
||
# Cache the installation of Poetry itself | ||
- name: cache poetry install | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local | ||
key: poetry-1.7.1-0 | ||
|
||
# Install Poetry | ||
- uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.8.3 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
# Cache dependencies | ||
- name: cache deps | ||
id: cache-deps | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: pydeps-${{ hashFiles('**/poetry.lock') }} | ||
|
||
# Install dependencies | ||
- run: poetry install --no-interaction --no-root | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
|
||
# Run tests | ||
- run: poetry run pytest tests/test_*.py |
This file contains 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 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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
# Ignore IDE files | ||
*.iml | ||
.idea | ||
|
||
# Ignore all files and folders starting with ".", except a few exceptions | ||
.* | ||
!.gitignore | ||
!.gitattributes | ||
!.github/ | ||
!.default.docker.env | ||
|
||
# Ignore generated files | ||
target | ||
bin | ||
dependency-reduced-pom.xml | ||
|
||
# Ignore IDE files | ||
*.iml | ||
release.properties | ||
pom.xml.* | ||
tests/__pycache__ |
This file contains 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 |
---|---|---|
@@ -1,16 +1,21 @@ | ||
ARG MAVEN_BUILDER=3-openjdk-17-slim | ||
ARG SONARQUBE_VERSION=10.6.0-community | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM maven:${MAVEN_BUILDER} AS builder | ||
ARG MAVEN_BUILDER_VERSION | ||
ARG SONARQUBE_VERSION | ||
|
||
COPY . /usr/src/ecocode | ||
FROM maven:${MAVEN_BUILDER_VERSION} AS builder | ||
|
||
WORKDIR /usr/src/ecocode | ||
COPY src src/ | ||
COPY pom.xml tool_build.sh ./ | ||
ARG ECOCODE_SRC_PATH=/usr/src/ecocode | ||
|
||
RUN ./tool_build.sh | ||
COPY . ${ECOCODE_SRC_PATH} | ||
|
||
WORKDIR ${ECOCODE_SRC_PATH} | ||
RUN ${ECOCODE_SRC_PATH}/toolbox.sh build | ||
|
||
FROM sonarqube:${SONARQUBE_VERSION} | ||
COPY --from=builder /usr/src/ecocode/target/ecocode-*.jar /opt/sonarqube/extensions/plugins/ | ||
|
||
ARG ECOCODE_SRC_PATH=/usr/src/ecocode | ||
ARG SONARQUBE_PLUGINS_PATH=/opt/sonarqube/extensions/plugins/ | ||
|
||
COPY --from=builder ${ECOCODE_SRC_PATH}/target/ecocode-*.jar ${SONARQUBE_PLUGINS_PATH} | ||
USER sonarqube |
This file contains 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 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,137 @@ | ||
# toolbox.sh | ||
|
||
## Overview | ||
|
||
This toolbox enables you to install the SonarQube dev environment. | ||
|
||
## Index | ||
|
||
* [build](#build) | ||
* [compile](#compile) | ||
* [docker_env_source](#dockerenvsource) | ||
* [docker_build](#dockerbuild) | ||
* [init](#init) | ||
* [start](#start) | ||
* [stop](#stop) | ||
* [clean](#clean) | ||
* [display_logs](#displaylogs) | ||
* [release](#release) | ||
* [release_push](#releasepush) | ||
* [display_help](#displayhelp) | ||
|
||
### build | ||
|
||
Compile and package source code with maven. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered when building source code. | ||
* **2**: If the ecoCode plugin in target directory cannot be found. | ||
|
||
### compile | ||
|
||
Compile source code with maven. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered when compiling the source code. | ||
|
||
### docker_env_source | ||
|
||
Export environment variables from .default.docker.env file. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If the environment file cannot be found. | ||
|
||
### docker_build | ||
|
||
Build Docker services. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered retrieving environment variables. | ||
* **2**: If an error has been encountered when building services. | ||
|
||
### init | ||
|
||
Building the ecoCode plugin and creating containers. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered when building project code in the target folder. | ||
* **2**: If an error was encountered retrieving environment variables. | ||
* **3**: If an error was encountered during container creating. | ||
|
||
### start | ||
|
||
Starting Docker containers. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered retrieving environment variables. | ||
* **2**: If the ecoCode plugin is not present in the target folder. | ||
* **3**: If an error was encountered during container startup. | ||
|
||
### stop | ||
|
||
Stopping Docker containers. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered retrieving environment variables. | ||
* **2**: If an error was encountered during container shutdown. | ||
|
||
### clean | ||
|
||
Stop and remove containers, networks and volumes. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered retrieving environment variables. | ||
* **2**: If an error was encountered during deletion. | ||
|
||
### display_logs | ||
|
||
Display Docker container logs. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error was encountered retrieving environment variables. | ||
|
||
### release | ||
|
||
Use maven plugin release to prepare locally next release and next SNAPSHOT. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If an error is encountered when prepare the release. | ||
* **2**: If an error is encountered when cleaning files. | ||
|
||
### release_push | ||
|
||
Create a push and a new branch with commits previously prepared. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
* **1**: If the last commit tag does not match the last git tag. | ||
|
||
### display_help | ||
|
||
Display help. | ||
|
||
#### Exit codes | ||
|
||
* **0**: If successful. | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put a comment for these 2 options, please