mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 23:05:49 +00:00
20240620_152943
This commit is contained in:
parent
0e2cac6323
commit
1fdd61ef67
4 changed files with 98 additions and 23 deletions
|
@ -13,11 +13,13 @@ pipelines:
|
||||||
caches:
|
caches:
|
||||||
- docker
|
- docker
|
||||||
script:
|
script:
|
||||||
- ps -p $$ && echo whoami && printenv | sort && cat /etc/os-release
|
- ps -p $$ && echo whoami
|
||||||
|
- cat /etc/os-release
|
||||||
- echo "$SHELL"
|
- echo "$SHELL"
|
||||||
- source scr_scrub_bitbucket_env_vars.sh
|
- source scr_scrub_bitbucket_env_vars.sh
|
||||||
- source scr_non_secret_env_vars.sh
|
- source scr_non_secret_env_vars.sh
|
||||||
- docker build
|
- printenv | sort
|
||||||
|
# - docker build -
|
||||||
# - source pack_install.sh
|
# - source pack_install.sh
|
||||||
# - which pack && pack version
|
# - which pack && pack version
|
||||||
# - bash create-settings.sh # Create our settings.xml file. Will fail if environment variables aren't set properly.
|
# - bash create-settings.sh # Create our settings.xml file. Will fail if environment variables aren't set properly.
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
||||||
|
|
||||||
|
export DOCKER_IMAGE_NAME="${BITBUCKET_REPO_FULL_NAME_SCRUBBED}"
|
||||||
|
export DOCKER_TAG_COMMIT_SHA="${BITBUCKET_COMMIT_SCRUBBED}"
|
||||||
|
export DOCKER_TAG_COMMIT_SHA="${BITBUCKET_COMMIT_SCRUBBED}"
|
||||||
|
export DOCKER_TAG_BRANCH_NAME="${BITBUCKET_BRANCH_SCRUBBED}"
|
||||||
|
export DOCKER_TAG_BRANCH_NAME="${BITBUCKET_PIPELINE_UUID_SCRUBBED}"
|
||||||
echo "$(date +%Y%m%d_%H%M%S) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
echo "$(date +%Y%m%d_%H%M%S) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,46 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
||||||
|
|
||||||
|
if [ -z ${BITBUCKET_BRANCH+x} ]; then # this shouldn't be defined locally, so we can use it to determine local vs pipeline run and tests...
|
||||||
|
source scr_test_pipeline_variables.sh
|
||||||
|
else
|
||||||
|
echo "Running in a pipeline, using Bitbuckets real variable values."
|
||||||
|
fi
|
||||||
|
|
||||||
# List of characters to replace
|
# List of characters to replace
|
||||||
declare -A char_replacements=(
|
declare -A char_replacements=(
|
||||||
[" "]=_
|
[" "]=_
|
||||||
["/"]=_
|
["/"]=_
|
||||||
[":"]=_
|
[":"]=_
|
||||||
["("]=_
|
["("]=_
|
||||||
[")"]=_
|
[")"]=_
|
||||||
["{"]=_
|
["{"]=_
|
||||||
["}"]=_
|
["}"]=_
|
||||||
["-"]=_
|
["-"]=_
|
||||||
)
|
)
|
||||||
|
|
||||||
# Function to scrub a string
|
|
||||||
scrub_string() {
|
scrub_string() {
|
||||||
local string=$1
|
local string=$1
|
||||||
for char in "${!char_replacements[@]}"; do
|
# Replace characters
|
||||||
string=${string//"$char"/"${char_replacements[$char]}"}
|
for char in "${!char_replacements[@]}"; do
|
||||||
done
|
string=${string//"$char"/"${char_replacements[$char]}"}
|
||||||
echo "$string"
|
done
|
||||||
|
# Replace multiple underscores with a single underscore
|
||||||
|
string=$(echo "$string" | sed 's/[_]\{2,\}/_/g')
|
||||||
|
# Remove leading and trailing underscores
|
||||||
|
string=$(echo "$string" | sed 's/^_//;s/_$//')
|
||||||
|
echo "$string"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Iterate through environment variables
|
# Iterate through environment variables
|
||||||
for var in $(printenv | grep '^BITBUCKET_' | cut -d= -f1); do
|
for var in $(printenv | grep '^BITBUCKET_' | cut -d= -f1); do
|
||||||
# Get the value of the variable
|
# Get the value of the variable
|
||||||
value=$(printenv "$var")
|
value=$(printenv "$var")
|
||||||
# Scrub the value
|
# Scrub the value
|
||||||
scrubbed_value=$(scrub_string "$value")
|
scrubbed_value=$(scrub_string "$value")
|
||||||
# Create a new variable with the scrubbed value
|
# Create a new variable with the scrubbed value
|
||||||
export "${var}_SCRUBBED=$scrubbed_value"
|
export "${var}_SCRUBBED=$scrubbed_value"
|
||||||
echo "${var}_SCRUBBED=$scrubbed_value"
|
echo "${var}_SCRUBBED=$scrubbed_value"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "$(date +%Y%m%d_%H%M%S) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
||||||
|
|
54
scr_test_pipeline_variables.sh
Normal file
54
scr_test_pipeline_variables.sh
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
||||||
|
|
||||||
|
export BITBUCKET_BRANCH="master"
|
||||||
|
export BITBUCKET_BUILD_NUMBER=6
|
||||||
|
export BITBUCKET_CLONE_DIR="/opt/atlassian/pipelines/agent/build"
|
||||||
|
export BITBUCKET_COMMIT="838e3b07699d7d5e40d63b726c2da28a435b9019"
|
||||||
|
export BITBUCKET_DOCKER_HOST_INTERNAL=10.36.100.59
|
||||||
|
export BITBUCKET_GIT_HTTP_ORIGIN="http://bitbucket.org/JBMTeam001/buildpack_sample"
|
||||||
|
export BITBUCKET_GIT_SSH_ORIGIN="git@bitbucket.org:JBMTeam001/buildpack_sample.git"
|
||||||
|
export BITBUCKET_PIPELINE_UUID="{b50a3a2f-7619-4150-b4da-0d04dc066874}"
|
||||||
|
export BITBUCKET_PROJECT_KEY="AF"
|
||||||
|
export BITBUCKET_PROJECT_UUID="{c479b31c-c7ce-4da1-9423-2a6923baf55b}"
|
||||||
|
export BITBUCKET_REPO_FULL_NAME="JBMTeam001/buildpack_sample"
|
||||||
|
export BITBUCKET_REPO_IS_PRIVATE="true"
|
||||||
|
export BITBUCKET_REPO_OWNER="JBMTeam001"
|
||||||
|
export BITBUCKET_REPO_OWNER_UUID="{28b9345c-ca85-4a49-9671-9751d59920cb}"
|
||||||
|
export BITBUCKET_REPO_SLUG="buildpack_sample"
|
||||||
|
export BITBUCKET_REPO_UUID="{01e961cc-e1fa-4bbb-be8c-e77d29350419}"
|
||||||
|
export BITBUCKET_SSH_KEY_FILE="/opt/atlassian/pipelines/agent/ssh/id_rsa"
|
||||||
|
export BITBUCKET_STEP_RUN_NUMBER=1
|
||||||
|
export BITBUCKET_STEP_TRIGGERER_UUID="{28b9345c-ca85-4a49-9671-9751d59920cb}"
|
||||||
|
export BITBUCKET_STEP_UUID="{514249ab-b4b7-464f-94ef-5ae27942fc82}"
|
||||||
|
export BITBUCKET_WORKSPACE="JBMTeam001"
|
||||||
|
export CI=true
|
||||||
|
export DISPLAY=:99
|
||||||
|
export DOCKER_HOST=tcp://localhost:2375
|
||||||
|
export HOME=/root
|
||||||
|
export HOSTNAME=514249ab-b4b7-464f-94ef-5ae27942fc82-9sqk9
|
||||||
|
export KUBERNETES_PORT=tcp://10.34.224.1:443
|
||||||
|
export KUBERNETES_PORT_443_TCP=tcp://10.34.224.1:443
|
||||||
|
export KUBERNETES_PORT_443_TCP_ADDR=10.34.224.1
|
||||||
|
export KUBERNETES_PORT_443_TCP_PORT=443
|
||||||
|
export KUBERNETES_PORT_443_TCP_PROTO=tcp
|
||||||
|
export KUBERNETES_SERVICE_HOST=10.34.224.1
|
||||||
|
export KUBERNETES_SERVICE_PORT=443
|
||||||
|
export KUBERNETES_SERVICE_PORT_HTTPS=443
|
||||||
|
export NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
|
||||||
|
export NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
|
||||||
|
export NVM_RC_VERSION=
|
||||||
|
export PATH=/root/.nvm:/bin/versions/node/v4.2.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
export PIPELINES_JWT_TOKEN=$PIPELINES_JWT_TOKEN
|
||||||
|
export PWD=/opt/atlassian/pipelines/agent/build
|
||||||
|
export SHLVL=1
|
||||||
|
export NAME="Ubuntu"
|
||||||
|
export VERSION="14.04.5 LTS, Trusty Tahr"
|
||||||
|
export ID=ubuntu
|
||||||
|
export ID_LIKE=debian
|
||||||
|
export PRETTY_NAME="Ubuntu 14.04.5 LTS"
|
||||||
|
export VERSION_ID="14.04"
|
||||||
|
export HOME_URL="http://www.ubuntu.com/"
|
||||||
|
export SUPPORT_URL="http://help.ubuntu.com/"
|
||||||
|
export BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
|
||||||
|
echo "$(date +%Y%m%d_%H%M%S) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
Loading…
Reference in a new issue