diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 402e7db..43a0352 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ stages: - deploy variables: - TIMEZONE: "Europe/Amsterdam" # For the system in general + TIMEZONE: "America/New_York" # For the system in general DATE_TIMEZONE: ${TIMEZONE} # For PHP GIT_DEPTH: 1 @@ -16,11 +16,11 @@ variables: # These could/should be overridden in an extending job: UPDATE_BRANCH_PREFIX: "update_PHP_deps_" # Used for the update branch name, it will be followed by the datetime - GIT_USER: "" # Used for the update commit - GIT_EMAIL: "" # Used for the update commit - GITLAB_USERNAME: "" # Used for pushing the new branch and opening the MR - GITLAB_ACCESS_TOKEN: "" # Used for pushing the new branch and opening the MR - MERGE_IF_SUCCESSFUL: "false" # Set to true, to merge automatically if the pipeline succeeds + GIT_USER: "DependBot" # Used for the update commit + GIT_EMAIL: "webmaster@thetempusproject.com" # Used for the update commit + GITLAB_USERNAME: "root" # Used for pushing the new branch and opening the MR + GITLAB_ACCESS_TOKEN: "glpat-PKEmivGtBfbz4DVPdhzk" # Used for pushing the new branch and opening the MR + MERGE_IF_SUCCESSFUL: "true" # Set to true, to merge automatically if the pipeline succeeds SECONDS_BETWEEN_POOLING: 10 # Nbr of seconds between checking if the MR pipeline is successful, so then it will merge JOB_GIT_FLAGS: "" JOB_CURL_FLAGS: "" @@ -29,8 +29,18 @@ variables: composer_update: stage: update image: composer:latest + interruptible: true # allows to stop the job if a newer pipeline starts, saving resources and allowing new jobs to start because job concurrency is limited script: - - composer update + - git ${JOB_GIT_FLAGS} fetch origin ${TARGET_BRANCH} + - git ${JOB_GIT_FLAGS} checkout ${TARGET_BRANCH} + - export DATE_TIME="$(date '+%Y%m%d%H%M%S')" + - export MR_BRANCH="${UPDATE_BRANCH_PREFIX}${DATE_TIME}" + - git ${JOB_GIT_FLAGS} checkout -b "${MR_BRANCH}" + - composer update ${JOB_COMPOSER_FLAGS} + - if [ "$(git diff)" == "" ]; then echo "No updates needed!"; exit 0; fi + - export TITLE="Update PHP dependencies [${DATE_TIME}]" + - git ${JOB_GIT_FLAGS} commit -a -m "${TITLE}" + - git ${JOB_GIT_FLAGS} push "${TARGET_REMOTE}" "${MR_BRANCH}" artifacts: paths: - vendor/