From 3d65b6dcf74600ca836881ef0b2580926af3d2cd Mon Sep 17 00:00:00 2001 From: Philipp Geyer Date: Mon, 17 Jun 2024 21:22:53 +0200 Subject: fixing script typo --- simepleci.sh | 71 ------------------------------------------------------------ 1 file changed, 71 deletions(-) delete mode 100755 simepleci.sh (limited to 'simepleci.sh') diff --git a/simepleci.sh b/simepleci.sh deleted file mode 100755 index 43aef34..0000000 --- a/simepleci.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))" - -JOB_DIR="${SCRIPT_DIR}/jobs" -WORKSPACE_DIR="${SCRIPT_DIR}/workspaces" - -check_for_remote_changes() { - local DIR=$1 - local BRANCH=$2 - - pushd "${DIR}" > /dev/null || { echo "Directory ${DIR} not found!"; return 1; } - - # Fetch the latest changes from the remote - git fetch - - # Get the local and remote commit hashes for the branch - LOCAL=$(git rev-parse "${BRANCH}") - REMOTE=$(git rev-parse "origin/${BRANCH}") - - # Check if local and remote are different - if [ "${LOCAL}" != "${REMOTE}" ]; then - echo $(date +"%Y-%m-%d %H:%M:%S") "Remote changes detected in ${DIR}" - popd > /dev/null - return 0 - else - echo $(date +"%Y-%m-%d %H:%M:%S") "No remote changes in ${DIR}" - popd > /dev/null - return 1 - fi -} - -trigger() { - REPO="" - BRANCH="live" - COMMAND="make publish" - source "${1}" - DIR="$(echo ${REPO##*/} | sed -e 's/\.git$//')" - FORCE=${2} - -# echo REPO=${REPO} -# echo BRANCH=${BRANCH} -# echo COMMAND=${COMMAND} -# echo DIR=${DIR} -# echo FORCE=${FORCE} - - if [ ${REPO} ]; then - if ! [ -e "${WORKSPACE_DIR}/${DIR}" ] ; then - git clone -b ${BRANCH} ${REPO} "${WORKSPACE_DIR}/${DIR}" - FORCE=1 - fi - if [ "${FORCE}" ] || check_for_remote_changes "${WORKSPACE_DIR}/${DIR}" "${BRANCH}"; then - pushd "${WORKSPACE_DIR}/${DIR}" - git pull origin ${BRANCH} # Pull the latest changes - ${COMMAND} - popd - fi - fi -} - -mkdir -p "${WORKSPACE_DIR}" - -if [ $# -gt 0 ] ; then - for i in $@ ; do - trigger "${JOB_DIR}/$i" 1 - done -else - for i in ${JOB_DIR}/* ; do - trigger "$i" - done -fi -- cgit v1.2.3-70-g09d2