20240625_131755

This commit is contained in:
Barry Matheney 2024-06-25 13:17:55 -04:00
parent d95353019a
commit 096099ae71
7 changed files with 21 additions and 202 deletions

View file

@ -21,24 +21,24 @@ jobs:
ls ${{ github.workspace }} -alt
echo "🍏 This job's status is ${{ job.status }}."
# docker:
# runs-on: ubuntu-latest
# steps:
# # -
# # name: Set up QEMU
# # uses: docker/setup-qemu-action@v3
# -
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# -
# name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ vars.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# -
# name: Build and push
# uses: docker/build-push-action@v6
# with:
# push: true
# tags: user/app:latest
docker:
runs-on: ubuntu-latest
steps:
# -
# name: Set up QEMU
# uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: user/app:latest

View file

@ -1,11 +0,0 @@
#!/usr/bin/env bash
echo "$(date +%Y%m%d_%H%M%S) Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
source scr__test__pipeline_variables.sh
source scr_local_secrets.sh
source scr_scrub_bitbucket_env_vars.sh
source scr_non_secret_env_vars.sh
source scr_validate_mandatory_variables.sh
echo "$(date +%Y%m%d_%H%M%S) Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"

View file

@ -1,54 +0,0 @@
#!/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)"

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
export HARBOR_USERNAME="barry_matheney@yahoo.com"
export HARBOR_LOGIN_ADDRESS="c8n.io/barrymatheney"
export HARBOR_ACCESS_TOKEN="whatever the access token that you created is"
echo "$(date +%Y%m%d_%H%M%S) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
export DOCKER_IMAGE_NAME="${HARBOR_LOGIN_ADDRESS}/${BITBUCKET_REPO_FULL_NAME_SCRUBBED}"
export DOCKER_TAG_PIPELINE_UUID="${BITBUCKET_PIPELINE_UUID_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)"

View file

@ -1,44 +0,0 @@
#!/usr/bin/env bash
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
# List of characters to replace
declare -A char_replacements=(
[" "]=_
["/"]=_
[":"]=_
["("]=_
[")"]=_
["{"]=_
["}"]=_
["-"]=_
)
scrub_string() {
local string=$1
# Replace characters
for char in "${!char_replacements[@]}"; do
string=${string//"$char"/"${char_replacements[$char]}"}
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/_$//')
# Convert to lowercase
string=$(echo "$string" | tr '[:upper:]' '[:lower:]')
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
echo "$(date +%Y%m%d_%H%M%S) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"

View file

@ -1,53 +0,0 @@
#!/usr/bin/env bash
echo "$(date +%Y%m%d_%H%M%S) - Entering $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"
# Function to check if a variable is defined
check_variable_defined() {
local var_name=$1
if [ -z "${!var_name}" ]; then
echo "$var_name"
fi
}
# List of necessary variables to check
necessary_variables=(
"DOCKER_IMAGE_NAME"
"HARBOR_LOGIN_ADDRESS"
"BITBUCKET_REPO_FULL_NAME_SCRUBBED"
"DOCKER_TAG_PIPELINE_UUID"
"BITBUCKET_PIPELINE_UUID_SCRUBBED"
"DOCKER_TAG_COMMIT_SHA"
"BITBUCKET_COMMIT_SCRUBBED"
"DOCKER_TAG_BRANCH_NAME"
"BITBUCKET_BRANCH_SCRUBBED"
"DOCKER_TAG_BRANCH_NAME"
"BITBUCKET_PIPELINE_UUID_SCRUBBED"
"HARBOR_ACCESS_TOKEN"
"HARBOR_USERNAME"
)
# Array to store undefined variables
undefined_variables=()
# Iterate through the list of necessary variables and check if they are defined
for var in "${necessary_variables[@]}"; do
result=$(check_variable_defined "$var")
if [ -n "$result" ]; then
undefined_variables+=("$result")
fi
done
# Print out which variables are not defined
if [ ${#undefined_variables[@]} -ne 0 ]; then
echo "The following variables are not defined:"
for var in "${undefined_variables[@]}"; do
echo "$var"
done
else
echo "MSG: All necessary variables are defined, should be good to go."
fi
echo "$(date +%Y%m%d_%H%M%S) - Leaving $(basename "$(realpath "${BASH_SOURCE[0]}")") on host $(hostname)"