mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 23:05:49 +00:00
20240620_143948
This commit is contained in:
parent
4e303139ba
commit
0e2cac6323
3 changed files with 74 additions and 0 deletions
37
bitbucket-piplines.yml
Normal file
37
bitbucket-piplines.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
image: atlassian/default-image:4
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
master: # Trigger this for any pushes to the master branch.
|
||||
- step:
|
||||
name: Buildpack
|
||||
trigger: automatic
|
||||
# caches:
|
||||
# - maven # Cache any dependencies we download, speeds up build times.
|
||||
services:
|
||||
- docker
|
||||
caches:
|
||||
- docker
|
||||
script:
|
||||
- ps -p $$ && echo whoami && printenv | sort && cat /etc/os-release
|
||||
- echo "$SHELL"
|
||||
- source scr_scrub_bitbucket_env_vars.sh
|
||||
- source scr_non_secret_env_vars.sh
|
||||
- docker build
|
||||
# - source pack_install.sh
|
||||
# - which pack && pack version
|
||||
# - bash create-settings.sh # Create our settings.xml file. Will fail if environment variables aren't set properly.
|
||||
# - mvn -B -s settings.xml verify # Ensure all artifacts build successfully before we attempt deploy in order to prevent partial deploys.
|
||||
# - mvn -B -s settings.xml deploy # Now that all builds have completed, we can deploy all the artifacts.
|
||||
# - step:
|
||||
# name: Create Release Version # This will create a release version and commit it to master. It will then be picked up and deployed in the first step.
|
||||
# trigger: manual
|
||||
# caches:
|
||||
# - maven
|
||||
# script:
|
||||
# - bash create-settings.sh # Create our settings.xml file. Will fail if environment variables aren't set properly.
|
||||
# - bash validate-release-configuration.sh # Do the best we can to ensure we have the SSH keys and env variables in place before we try to prepare a release.
|
||||
# - git config --global user.email "$GIT_USER_EMAIL"
|
||||
# - git config --global user.name "$GIT_USER_NAME"
|
||||
# - mvn -B -s settings.xml -DdryRun=true release:prepare # Ensure that most things will run properly before we do the real work.
|
||||
# - mvn -B -s settings.xml release:clean release:prepare # This bumps the versions in the poms, creates new commits, which will then get built by the master branch trigger.
|
5
scr_non_secret_env_vars.sh
Normal file
5
scr_non_secret_env_vars.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/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) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
|
||||
|
32
scr_scrub_bitbucket_env_vars.sh
Normal file
32
scr_scrub_bitbucket_env_vars.sh
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
# List of characters to replace
|
||||
declare -A char_replacements=(
|
||||
[" "]=_
|
||||
["/"]=_
|
||||
[":"]=_
|
||||
["("]=_
|
||||
[")"]=_
|
||||
["{"]=_
|
||||
["}"]=_
|
||||
["-"]=_
|
||||
)
|
||||
|
||||
# Function to scrub a string
|
||||
scrub_string() {
|
||||
local string=$1
|
||||
for char in "${!char_replacements[@]}"; do
|
||||
string=${string//"$char"/"${char_replacements[$char]}"}
|
||||
done
|
||||
echo "$string"
|
||||
}
|
||||
|
||||
# Iterate through environment variables
|
||||
for var in $(printenv | grep '^BITBUCKET_' | cut -d= -f1); do
|
||||
# Get the value of the variable
|
||||
value=$(printenv "$var")
|
||||
# Scrub the value
|
||||
scrubbed_value=$(scrub_string "$value")
|
||||
# Create a new variable with the scrubbed value
|
||||
export "${var}_SCRUBBED=$scrubbed_value"
|
||||
echo "${var}_SCRUBBED=$scrubbed_value"
|
||||
done
|
Loading…
Reference in a new issue