Skip to content

Commit

Permalink
cut out more jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
CamJN committed Aug 19, 2024
1 parent 6084812 commit fb4198c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
27 changes: 12 additions & 15 deletions dev/ci/lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,11 @@ function autodetect_environment()
echo "Operating system: Linux"
export OS=linux
fi
if [[ "$JENKINS_HOME" != "" ]]; then
echo "Running in Jenkins: yes"
export IN_JEKINS=true
if [ $OS = "linux" ]; then
export CACHE_DIR="$JENKINS_HOME/cache/$JOB_NAME/executor-$EXECUTOR_NUMBER"
else
require_envvar WORKSPACE "$WORKSPACE"
export CACHE_DIR="$WORKSPACE/cache/$JOB_NAME/executor-$EXECUTOR_NUMBER"
fi
if [ "${GITHUB_ACTIONS:-false}" = "true" ]; then
echo "Running in Github Actions: yes"
export CACHE_DIR="$RUNNER_TOOL_CACHE/$GITHUB_JOB/$RUNNER_OS"
else
echo "Running in Jenkins: no"
export IN_JENKINS=false
echo "Running in Github Actions: no"
export CACHE_DIR="$PASSENGER_ROOT/.ci_cache"
fi
echo "Cache directory: $CACHE_DIR"
Expand All @@ -97,13 +90,17 @@ function autodetect_environment()
function sanity_check_environment()
{
if [ "${GITHUB_ACTIONS:-false}" = "true" ]; then
if [[ "$JOB_NAME" = "" ]]; then
echo "ERROR: Jenkins environment detected, but JOB_NAME environment variable not set." >&2
if [ -z "$GITHUB_JOB" ]; then
echo "ERROR: Github Actions environment detected, but GITHUB_JOB environment variable not set." >&2
return 1
else
export "JOB_NAME=$GITHUB_JOB"
fi
if [[ "$EXECUTOR_NUMBER" = "" ]]; then
echo "ERROR: Jenkins environment detected, but EXECUTOR_NUMBER environment variable not set." >&2
if [ -z "$GITHUB_RUN_ID" ]; then
echo "ERROR: Github Actions environment detected, but GITHUB_RUN_ID environment variable not set." >&2
return 1
else
export "EXECUTOR_NUMBER=$GITHUB_RUN_ID"
fi
fi
}
Expand Down
3 changes: 1 addition & 2 deletions dev/ci/setup-host
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ if [ "${GITHUB_ACTIONS:-false}" = "true" ]; then
find ./* -type d -print0 | xargs -0 -n 512 chmod g+rx,o+rx

# Create this file now because otherwise it would be owned by root,
# which Jenkins cannot remove.
run touch test/test.log

echo
Expand All @@ -44,7 +43,7 @@ run mkdir -p "$CACHE_DIR/ccache"
run mkdir -p "$CACHE_DIR/npm"
echo

# Directory must exist so that Jenkinsfile can run archiveArtefacts().
# Directory must exist so that workflow can upload artifacts.
header2 "Creating buildout directory"
run mkdir -p buildout buildout/testlogs
echo
Expand Down

0 comments on commit fb4198c

Please sign in to comment.