Skip to content

Commit

Permalink
Cleanup script in to functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob authored and Rob committed Nov 15, 2024
1 parent 7f974b7 commit 8f142b9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions automated_builder/roles/common/templates/install_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ VERSION_TAG="$3"
GITHUB_EVENT_NAME="$4"

main() {
echo "$0: START"
echo "Running source code installation script..."
determine_event
clean_old_source
install_source_code
checkout_code
}

determine_event() {
echo "Determining source code ref"
echo "REPO_URL: $REPO_URL"
echo "COMMIT_BRANCH: $COMMIT_BRANCH"
echo "VERSION_TAG: $VERSION_TAG"
echo "GITHUB_EVENT_NAME: $GITHUB_EVENT_NAME"

if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
skip_tag="true"
echo "Detected pull request. VERSION_TAG set to empty."
if [[ "${GITHUB_EVENT_NAME}" = "pull_request" ]]; then
SKIP_TAG=1
echo "Detected pull request. SKIP_TAG set to true"
else
echo "Regular branch or tag push. Using provided VERSION_TAG: $VERSION_TAG"
echo "Tag or commit push. Using provided ref: $VERSION_TAG"
fi

clean_old_source
install_source_code
checkout_code

echo "$0: END"
}

clean_old_source() {
Expand Down

0 comments on commit 8f142b9

Please sign in to comment.