there are three commands in maven/bin:
mvn
mvnDebug
mvnyjp
I just find nothing about "mvnyjp".
How and when to use it?
Its a shell script intended to be used with Yourkit profiler.
Used to profile maven build process.
It's a script file and therefore readable:
# -----------------------------------------------------------------------------
# Apache Maven YourKit Profiler Startup Script
#
# Environment Variable Prerequisites
#
# JAVA_HOME Must point at your Java Development Kit installation.
# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
# -----------------------------------------------------------------------------
if [ ! -f "$YJPLIB" ]; then
echo "Error: Unable to autodetect the YJP library location. Please set YJPLIB variable" >&2
exit 1
fi
env MAVEN_OPTS="-agentpath:$YJPLIB=onexit=snapshot,onexit=memory,tracing,onlylocal $MAVEN_OPTS" "`dirname "$0"`/mvn" "$#"
So it seems like it's only of interest, if you are using the YourKit Profiler.
Related
I would like to get the buildId (such as #2594) of the current teamcity job as an input to my script. I tried:
if [ $? != 0 ]; then
python store_test_artifacts.py --buildId %system.build.number%
fi
But this leads to the error:
There are no compatible agents which can run this build.
and
Implicit requirements:
system.teamcity.build.id defined in Build step: Setup
How can I pass the buildID shown in teamcity to my script?
It's available as a environment variable:
echo $BUILD_NUMBER
I have the following configuration in ~/.config/fish/conf.d/python.fish:
# Initialise pyenv if found
echo "Running python config"
if status --is-interactive && test -d "$HOME/.pyenv"
echo "Inside pyenv if"
set -pxg PATH $HOME/.pyenv/bin $HOME/.pyenv/shims
source ("$HOME/.pyenv/bin/pyenv" init - | psub)
echo "End pyenv if"
end
# Poetry settings
if status --is-interactive && test -d "$HOME/.pyenv"
set -xg POETRY_VIRTUALENVS_IN_PROJECT 1
set -xg POETRY_VIRTUALENVS_CREATE 1
set -pxg PATH $HOME/.poetry/bin
end
echo "End python config"
Every single echo command in the configuration is executed when I am creating a new shell, but the PATH variable is not modified. However, the POETRY_ variables show up as expected.
But things work as expected if I source the file in an existing shell with
source ~/.config/fish/conf.d/python.fish
What could possibly be wrong here?
Update: The problem only occurs inside of tmux, and not when I am starting terminals like Alacritty or Kitty. But all echo commands is still run inside tmux.
This was a Debian bug - they added configuration that reset $PATH, and it happened after the user's configuration snippets but before config.fish.
This appears to be fixed in Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000199. Now they merely add the default directories instead of replacing $PATH entirely.
Because config.fish is read after all the conf.d files, you can always use config.fish to override anything done in the snippets, like if your vendor breaks things.
Is it possible to run Java based test automation suite on Bitrise CI/CD?
Functionalities which I will be looking at:
- Maven Runtime
- String Parameters passing
- Cucumber-JVM
- Connectivity to Cloud devices provider like Browserstack(web) / Saucelabs(mobile)
Also, what kind of job will we need to set-up on Bitrise, for this purpose
Thanks
This can be achieved by using a Script step which calls a script inside your repository: (Path is relative to your repo)
Script Step:
#!/usr/bin/env bash
set -ex
bash ./scripts/bitrise/test_controller.sh
Inside the test_controller.sh we have logic which controls the other bash scripts to execute (can use ruby as well), which will we will then run maven in:
test_controller.sh
#!/usr/bin/env bash
set -ex
if [[ "$SHOULD_RUN_SPECIFIC_TESTS" == "false" && "$SHOULD_RUN_RELEASE_TESTS" == "false" ]]; then
if [[ $BITRISE_TRIGGERED_WORKFLOW_TITLE == "iOS-Appium" ]]; then
echo "=> Executing run_develop_ios_tests.sh"
bash ./scripts/bitrise/ios/run_develop_ios_tests.sh
exit 0
elif [[ $BITRISE_TRIGGERED_WORKFLOW_TITLE == "Android-Appium" ]]; then
echo "=> Executing run_develop_android_tests.sh"
bash ./scripts/bitrise/android/run_develop_android_tests.sh
exit 0
fi
fi
If we don't want to run specific tests, and not release, and the workflow that triggered this run is iOS-Appium, then we run execute run_develop_ios_tests.sh:
run_develop_ios_tests.sh
#!/usr/bin/env bash
set -ex
mvn clean test \
-DplatformName=IOS \
-Dsurefire.suiteXmlFiles="${XML_FILES}" \
-DIOS_DEVICE_NAME="${IOS_DEVICE_NAME}" \
-DIOS_PLATFORM_VERSION="${IOS_PLATFORM_VERSION}" \
-DSAUCE_USERNAME="${SAUCE_USERNAME}" \
-DSAUCE_ACCESS_KEY="${SAUCE_ACCESS_KEY}"
The logic inside the test controller, is driven by env variables -- and so are the string params which guide our mvn clean test command.
Since we connect to SauceLabs remotely, we do not need any special agent for this. Just JDK and Maven, which are pre-installed.
Bitrise definitely provides these functionality and can auto configure or recommend some solution while you're doing the project setup. If you'd need any help/guidance along the process contact the Bitrise support (via the onsite chat or email), they can help you with your specific setup :)
I am facing an issue using environment variables in my service script.
In my services script, i am using an environmental variable i.e. INSTALL_DIR whose value may vary on different system. I have to get the installation directory from $INSTALL_DIR and then i have to start the service. when i am running the service script the environment variable is not sourced at all.
Is it possible to source the installation directory from INSTALL_DIR environment variable. another option i can think is dynamically creating the service script using INSTALL_DIR environment variable.
echo "INSTALL DIR: ${INSTALL_DIR}"
name=`basename $0`
pid_file="/var/run/$name.pid"
get_pid() {
cat "$pid_file"
}
is_running() {
[ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
}
Start()
{
echo "Starting Application"
if is_running; then
echo "[`get_pid`] Already Started"
else
if [ -z "$user" ]; then
nohup $INSTALL_DIR/bin/application 2>&1 &
else
nohup sudo -u "$user" $cmd 1> $INSTALL_DIR/bin/application 2>&1 &
fi
echo $! > "$pid_file"
if ! is_running; then
echo "Unable to start, see logs"
exit 1
fi
echo "[`get_pid`] Started"
fi
}
I am trying to run the application using following command
service application start
In my services script ... I have to get the installation directory from $INSTALL_DIR and then i have to start the service.
Your question isn't really about shell scripting, but about your system's startup. Unfortunately that process varies by Linux distribution, and tends to be poorly documented.
For example, man service says, service runs a System V init script or upstart job in as predictable an environment as possible, removing most environment variables and with the current working directory set to /., but man upstart says:
$ man -k upstart
upstart: nothing appropriate.
Not only that, but the service manpage specifically lists the environment variables a script will start with. Needless to say, yours isn't among them.
The traditional approach to parameterizing startup scripts is to put the information in a known file, normally in /etc, and reference that file in the script. In your case, you could do something like:
INSTALL_DIR=$(cat /etc/my-install-dir.cfg)
and then proceed accordingly.
There might be ways to coerce your startup to support other environment variables. But, sooner or later, the information you need has to be stored somewhere on the filesystem. It seems to me the simplest approach is to reserve a filename to hold that information, and read that file directly.
Use this below code in your script.
if [[ -z "${INSTALL_DIR}" ]]; then
echo "INSTALL_DIR is undefined"
else
INSTALL_DIR=<<your installation directory>>
fi
I want to instruct Capistrano to load environment variables that are defined on remote server. How can I do that?
It seems that when I export my environment variables inside .bashrc file, they are not taken into account by Capistrano. Capistrano seems to be executing a /usr/bin/env to create the environment for executing remote commands, but this does not seem to be loading the environment variables from .bashrc.
Let me tell you also that I am using rvm-capistrano too (just in case it might help).
Any clue?
Capistrano actually does load .bashrc. But near the top of the file you will find one of the following lines:
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
If you do any exporting after the above lines, it will not be reached by Capistrano. The solution was simply to move my setup above this lineāand Capistrano works how I want.
This solution was also noted at this GitHub issue.
You can pass your current environment variables to a remote execution with ssh by issuing:
env | ssh user#host remote_program
Also taken the example from here
on roles(:app), in: :sequence, wait: 5 do
within "/opt/sites/example.com" do
# commands in this block execute in the
# directory: /opt/sites/example.com
as :deploy do
# commands in this block execute as the "deploy" user.
with rails_env: :production do
# commands in this block execute with the environment
# variable RAILS_ENV=production
rake "assets:precompile"
runner "S3::Sync.notify"
end
end
end
end
looks like you can use with set environment variables for your execution. So read your current environment variables and set them using with .
Capistrano doesn't load .bashrc since it's not interactive shell. As far as I remember though it does load .bash_profile though so you will probably have better luck using that.
In Capistrano 3 it's set :default_env, { ... }
Like here:
set :default_environment, {
'env_var1' => 'value1',
'env_var2' => 'value2'
}
You can refer to this:
Previous post..