You can use the += operator to append to an array.
args=()
for i in "$@"; do
args+=("$i")
done
echo "${args[@]}"You can use the += operator to append to an array.
args=()
for i in "$@"; do
args+=("$i")
done
echo "${args[@]}"The Groovy script you provided is formatting the first line as a blank line in the resultant script. The shebang, telling the script to run with /bin/bash instead of /bin/sh, needs to be on the first line of the file or it will be ignored.
So instead, you should format your Groovy like this:
stage('Setting the variables values') {
steps {
bash '''#!/bin/bash
echo "hello world"
'''
}
}if(members){
//Some work
}
def exists = fileExists 'file'
if (exists) {
echo 'Yes'
} else {
echo 'No'
}
# wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
# unzip sonar-scanner-cli-3.2.0.1227-linux.zip
# mv sonar-scanner-3.2.0.1227-linux /opt/sonar_scanner
<SONAR_SERVER_IP>:9000Manage Jenkins > Manage Plugins > Avalable > SonarQube scannerManage Jenkins > Global Tool Configuration > SonarQube Scannersonar_scanner/opt/sonar_scannerManage Jenkins > Configure Systems > SonarQube ServersSonarQubehttp://<Sonarqube_server>:9000/sonarauthentication token To Get Authentication code follow below steps. Login to SonarQube server as a admin My Account > Security > Generate TokenExecute SonarQube Scanner > Analysis properties (it is mandatary).ValaxyValaxyDemo1.0/var/lib/jenkins/workspace/$JOB_NAME/<PROJECT_NAME>/src| version: "3" | |
| services: | |
| sonarqube: | |
| image: sonarqube | |
| expose: | |
| - 9000 | |
| ports: | |
| - "127.0.0.1:9000:9000" | |
| networks: | |
| - sonarnet | |
| environment: | |
| - SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar | |
| - SONARQUBE_JDBC_USERNAME=sonar | |
| - SONARQUBE_JDBC_PASSWORD=sonar | |
| volumes: | |
| - sonarqube_conf:/opt/sonarqube/conf | |
| - sonarqube_data:/opt/sonarqube/data | |
| - sonarqube_extensions:/opt/sonarqube/extensions | |
| - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins | |
| db: | |
| image: postgres | |
| networks: | |
| - sonarnet | |
| environment: | |
| - POSTGRES_USER=sonar | |
| - POSTGRES_PASSWORD=sonar | |
| volumes: | |
| - postgresql:/var/lib/postgresql | |
| - postgresql_data:/var/lib/postgresql/data | |
| networks: | |
| sonarnet: | |
| volumes: | |
| sonarqube_conf: | |
| sonarqube_data: | |
| sonarqube_extensions: | |
| sonarqube_bundled-plugins: | |
| postgresql: | |
| postgresql_data: |

docker pull jenkins/jenkins
docker run -d -p 8080:8080 -p 50000:50000 --name jenkins-article jenkins/jenkins:latest








docker run -d --name sonarqube-article -p 9000:9000 sonarqube

docker exec -it jenkins-article bash
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-linux.zip
unzip sonar-scanner-cli-3.3.0.1492-linux.zip




