How Do You Get a Jenkins Plugin to Work That Normally Uses the Internet When You Have No Internet Access?

Problem scenario
Your Jenkins server has no access to the internet.  You are trying to run a  Jenkins job that involves a plugin.  You receive a 407 error when a job runs.  You look at the console output and see java.io error that deals with being unable to connect to a website.  How do you customize a Jenkins plugin to retrieve installation media from an internal server instead of a default website URL?

 » Read more..

Why Cannot You Use a Python Module in a Program or the Command Prompt When One Will Work but Not the Other?

Problem scenario
You have a Python program use an import statement, but the program fails.  From the Python command prompt, you can import the module.  Why is it different?

Possible Solution #1
You may be using Python version 3 for either the command prompt or the program and Python version 2 for the complement (either the command prompt or the program). Try these commands:

python –version
python3 –version

Possible Solution #2
See where the potential imports are.

 » Read more..

How Do You Get the Sonar Scanner Tool to Be Reinstalled on a Jenkins Slave?

Problem scenario
You want to uninstall the Sonar Scanner CLI to force its reinstallation as you have a Jenkins job that does the installation automatically.  What do you do to uninstall it and make the Jenkins job do the installation again?

Solution
1.  For the Sonar Scanner job that will run, configure it so it runs on a specific slave.  Log into Jenkins.  Go to the Jenkins job,

 » Read more..

How Do You Get a GCP Server to Present a Website on the Internet?

Problem scenario
You want to browse the web UI of a web application that you set up on a Linux machine in GCP.  How do you get a web service (e.g., Nginx, Apache web server, SonarQube or Jenkins) to work when the server is in Google Cloud Platform?

Solution
Prerequisites
This assumes you have deployed the web application.  If you want to deploy Nginx,

 » Read more..

How Do You Troubleshoot the Error “Invalid Option” When Trying to Delete a File That Has a File Name with the First Character Being a Hyphen or Dash “-“?

Problem scenario
You have some files that have a name that starts with a hyphen (e.g., from some Bash script that did not work as intended):

-the
-filename
-q

You cannot delete them using rm.  You get an error about an “invalid option”.  What should you do to delete this files that should never have been created in the first place?

 » Read more..

How Do You Find Your Phone Number with an Android Phone?

Problem scenario
You are using an Android phone, and you want to find its phone number.

Solution
1.  Turn on your Android phone.
2.  Go to Tools -Settings
3.  Scroll down to the “System” section and click on About phone -SIM status.  You should see the phone number at the bottom.

If you want to buy a new Android phone,

 » Read more..

How Do You Test the Database Credentials (username and password) of a PostgreSQL Database Using Bash?

Problem scenario
You are not sure if the username and password to a PostgreSQL database work.  What do you do?

Solution
Run this one-line command:

psql -d “postgresql://jdoe:coolpassword@localhost/foobardb” -c “select now()”

# Replace “jdoe” with the SQL database username
# Replace “coolpassword” with the user’s password
# Replace “foobardb” with the name of the database you are authenticating too
# If you have the PostgreSQL client installed (so psql works) and the database is remote,

 » Read more..

How Do You Configure Jenkins Builds to Avoid Slave Servers That Are Either Windows or Linux?

Problem scenario
You are configuring Jenkins jobs.  You want certain jobs to only run on Windows slaves (e.g., PowerShell jobs) and certain jobs to only run on Linux slaves (e.g., Bash scripts).  You want to force a job force a selection of a slave server to avoid Windows or Linux servers.  How do you have Jenkins avoid slave servers based on the OS architecture?

Solution
1.  Go to the job and click on “Configure” or create a new job.

 » Read more..

How Do You Find the Version of SonarQube That You Have Installed?

Problem scenario
You have installed SonarQube.  You want to know what version you are using.  How do you find out?

Solution
Go to the web UI for SonarQube.  It may be as simple as opening a web browser and entering the external IP address of the server.  Without logging in scroll to the bottom.  You should see something like this near the bottom:  Version 6.7 (build 33306)

 » Read more..

How Do You Change the Base URL for SonarQube?

Problem scenario
Currently you have to enter a URL like this to access SonarQube’s web UI:

http://servername.com:9000/sonar

You want to be able to type no path (e.g., no “sonar”) in the web browser.  You want to just enter the hostname in the web browser and the port number of the SonarQube server.  What should you do?

Solution
Go to the conf directory [that is a sibling] with the sonar.properties file. 

 » Read more..