JiaLiangC commented on PR #3775:
URL: https://github.com/apache/ambari/pull/3775#issuecomment-1999127109
@virajjasani thanks for your effort
In Ubuntu, the installation location of `chromium-browser` can vary
depending on the method used for installation, such as directly from the Ubuntu
repositories or through a snap package. Common installation locations include:
1. **Installed via apt** (Ubuntu repositories):
- `/usr/bin/chromium-browser`
2. **Installed via snap**:
- `/snap/bin/chromium`
For modifying the Jenkins script, there are two suggested approaches:
### Approach 1: Limit the Search Scope
Since `chromium-browser` is most likely installed in `/usr/bin/` or
`/snap/bin/` for snap installations, you can directly check these locations
instead of the entire filesystem to avoid unnecessary permission issues. The
modified Jenkins script could look like this:
```groovy
stage('Parallel Unit Tests') {
parallel {
stage('Ambari WebUI Tests') {
steps {
sh 'lsb_release -a'
sh 'ls /usr/bin'
// Directly check possible installation locations
sh 'if [ -f /usr/bin/chromium-browser ]; then export
CHROME_BIN=/usr/bin/chromium-browser; fi'
sh 'if [ -f /snap/bin/chromium ]; then export
CHROME_BIN=/snap/bin/chromium; fi'
sh 'mvn -X -T 2C -am test -pl ambari-web,ambari-admin
-Dmaven.artifact.threads=10 -Drat.skip'
}
}
// Other test stages...
}
}
```
### Approach 2: Using sudo
If you need to search the entire filesystem for `chromium-browser` and you
have permissions to use `sudo` in Jenkins scripts, you can run the `find`
command with `sudo`. However, this is generally not recommended for security
reasons, as it could expose sensitive parts of the system or unnecessarily
elevate script permissions. If you decide to use `sudo`, ensure the Jenkins
user has appropriate `sudo` privileges and the `sudoers` configuration is
correct. The modified command might look like:
```sh
sh 'sudo find / -name "chromium-browser" 2>/dev/null'
```
Here, `2>/dev/null` is used to ignore error output, such as permission
denied messages.
**Security Tip**: In production environments, avoid using `sudo` for
commands that could affect system security and stability. Approach 1 is a
safer, more focused method and should be considered first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]