diff --git a/scripts/upgrade b/scripts/upgrade index 7a4d3db..634757f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -148,21 +148,49 @@ then source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh last_version=$gitlab_version - source_current_major_version () { + source_next_version () { + # We start with the upgrade.$current_major_version.first.sh if [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.first.sh" ]; then source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.first.sh - elif [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh" ]; then + if dpkg --compare-versions "$gitlab_version" "gt" "$current_version"; then + return + fi + fi + + # Then upgrade to all minor versions + for minor_verion in $(ls $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version* | grep -v -E ".first.sh$|.last.sh$" | sed -e "s@$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.@@" -e "s/.sh$//" | sort) + do + source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.$minor_verion.sh + if dpkg --compare-versions "$gitlab_version" "gt" "$current_version" + then + return + fi + done + + # Then end with upgrade.$current_major_version.last.sh + if [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh" ]; then source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh - # Finish with the last migration if the file doesn't exist + if dpkg --compare-versions "$gitlab_version" "gt" "$current_version" + then + return + fi else source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh + if dpkg --compare-versions "$gitlab_version" "gt" "$current_version" + then + return + fi + fi + # Increment the major version to upgrade to the next version + if dpkg --compare-versions "$gitlab_version" "le" "$current_version"; then + current_major_version=$(($current_major_version + 1)) + source_next_version fi } - # To update GitLab from major version A to B, we have to go to the last minor version - # of the major version A and then go to the first minor version of the major version B - # to finally go to the current minor version of the major version B - # A.last -> B.first -> B.last + # To upgrade GitLab from a major version A to a major version B, + # we need to follow a specific path described here https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/ + # A.last -> B.first -> -> B.X -> B.Y -> B.last # While the current version is not the last version, do an upgrade while [ "$last_version" != "$current_version" ] @@ -219,22 +247,9 @@ then current_major_version=${current_version%%.*} - source_current_major_version + source_next_version - # if the version stored in the upgrade.$current_major_version.first.sh file is less than or equal - # to the current version, and if the version stored in the upgrade.$current_major_version.last.sh file - # increment the major version to upgrade to the next version - if dpkg --compare-versions "$gitlab_version" "le" "$current_version"; then - if [ -e "$YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh" ]; then - source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.$current_major_version.last.sh - else - source $YNH_APP_BASEDIR/scripts/upgrade.d/upgrade.last.sh - fi - if dpkg --compare-versions "$gitlab_version" "le" "$current_version"; then - current_major_version=$(($current_major_version + 1)) - source_current_major_version - fi - fi + ynh_print_info --message="Upgrade from ${current_version} to ${gitlab_version}" ynh_add_config --template="$YNH_APP_BASEDIR/conf/$architecture.src.default" --destination="$YNH_APP_BASEDIR/conf/$architecture.src" diff --git a/scripts/upgrade.d/upgrade.15.4.sh b/scripts/upgrade.d/upgrade.15.4.sh new file mode 100644 index 0000000..1d2483f --- /dev/null +++ b/scripts/upgrade.d/upgrade.15.4.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +gitlab_version="15.4.6" + +# sha256sum found here: https://packages.gitlab.com/gitlab +gitlab_debian_version="$(lsb_release -sc)" + +gitlab_x86_64_bullseye_source_sha256="1e328997adb13fca9fb829218d6556c14065d9889997e6b7330f554cf812455a" +gitlab_x86_64_buster_source_sha256="9fd1cc1fde6dbc1ec3c5528eea74f57c355f098ed26d5ad914ce30e2acd5764e" + +gitlab_arm64_bullseye_source_sha256="fff8625d2cbdb45bc3d90e4414ac6b4b9023a24526ab73f0f86d7177e3129915" +gitlab_arm64_buster_source_sha256="3c35b28717a06b17ce7854c76d0ab35dc73554061ad3881170be68b072a53cf7" + +gitlab_arm_buster_source_sha256="33a60e701921117542de771b8c0e2c83c7cbd2730f199e4c88c8adc6eb1c4579" + +architecture=$(ynh_app_setting_get --app="$app" --key=architecture) + +if [ "$architecture" = "x86-64" ]; then + if [ "$gitlab_debian_version" = "bullseye" ] + then + gitlab_source_sha256=$gitlab_x86_64_bullseye_source_sha256 + elif [ "$gitlab_debian_version" = "buster" ] + then + gitlab_source_sha256=$gitlab_x86_64_buster_source_sha256 + fi +elif [ "$architecture" = "arm64" ]; then + if [ "$gitlab_debian_version" = "bullseye" ] + then + gitlab_source_sha256=$gitlab_arm64_bullseye_source_sha256 + elif [ "$gitlab_debian_version" = "buster" ] + then + gitlab_source_sha256=$gitlab_arm64_buster_source_sha256 + fi +elif [ "$architecture" = "arm" ]; then + gitlab_source_sha256=$gitlab_arm_buster_source_sha256 +fi + +gitlab_filename="gitlab-ce-${gitlab_version}.deb" + +# Action to do in case of failure of the package_check +package_check_action() { + ynh_backup_if_checksum_is_different --file="$config_path/gitlab.rb" + cat <> "$config_path/gitlab.rb" +# Last chance to fix Gitlab +package['modify_kernel_parameters'] = false +EOF + ynh_store_file_checksum --file="$config_path/gitlab.rb" +} diff --git a/scripts/upgrade.d/upgrade.16.3.sh b/scripts/upgrade.d/upgrade.16.3.sh new file mode 100644 index 0000000..8cc5a41 --- /dev/null +++ b/scripts/upgrade.d/upgrade.16.3.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +gitlab_version="16.3.5" + +# sha256sum found here: https://packages.gitlab.com/gitlab +gitlab_debian_version="$(lsb_release -sc)" + +gitlab_x86_64_bullseye_source_sha256="80bf49ae846133f7a19267b494024a4010e64839829262ef5241f1fb585dc60c" +gitlab_x86_64_buster_source_sha256="ae216aa3e1831b928fe8a0a543cc3734e3ac3d6191d7eb5111f061f38b67e36c" + +gitlab_arm64_bullseye_source_sha256="e38a2347f1b0c6af3dcac5cc5746b37db7059c9e8d4c82efaa90bcc7f8532f4e" +gitlab_arm64_buster_source_sha256="98bf7cc6ad9c339d90f6fd3e6ad90431b14c9817269278a5de6eff6a652264ca" + +gitlab_arm_buster_source_sha256="b4fe665d35674a641755eb5d966cd4b05877c9149ba27a629960e82465432dda" +gitlab_arm_bullseye_source_sha256="b37e5318c90822d2ded46b604f7976c8b4a54764df5c937d48d6360d864531fe" + +architecture=$(ynh_app_setting_get --app="$app" --key=architecture) + +if [ "$architecture" = "x86-64" ]; then + if [ "$gitlab_debian_version" = "bullseye" ] + then + gitlab_source_sha256=$gitlab_x86_64_bullseye_source_sha256 + elif [ "$gitlab_debian_version" = "buster" ] + then + gitlab_source_sha256=$gitlab_x86_64_buster_source_sha256 + fi +elif [ "$architecture" = "arm64" ]; then + if [ "$gitlab_debian_version" = "bullseye" ] + then + gitlab_source_sha256=$gitlab_arm64_bullseye_source_sha256 + elif [ "$gitlab_debian_version" = "buster" ] + then + gitlab_source_sha256=$gitlab_arm64_buster_source_sha256 + fi +elif [ "$architecture" = "arm" ]; then + if [ "$gitlab_debian_version" = "bullseye" ] + then + gitlab_source_sha256=$gitlab_arm_bullseye_source_sha256 + elif [ "$gitlab_debian_version" = "buster" ] + then + gitlab_source_sha256=$gitlab_arm_buster_source_sha256 + fi +fi + +gitlab_filename="gitlab-ce-${gitlab_version}.deb" + +# Action to do in case of failure of the package_check +package_check_action() { + ynh_backup_if_checksum_is_different --file="$config_path/gitlab.rb" + cat <> "$config_path/gitlab.rb" +# Last chance to fix Gitlab +package['modify_kernel_parameters'] = false +EOF + ynh_store_file_checksum --file="$config_path/gitlab.rb" +} diff --git a/scripts/upgrade.d/upgrade.16.first.sh b/scripts/upgrade.d/upgrade.16.first.sh index bb9a63f..07c9c25 100644 --- a/scripts/upgrade.d/upgrade.16.first.sh +++ b/scripts/upgrade.d/upgrade.16.first.sh @@ -1,18 +1,18 @@ #!/bin/bash -gitlab_version="16.0.0" +gitlab_version="16.1.5" # sha256sum found here: https://packages.gitlab.com/gitlab gitlab_debian_version="$(lsb_release -sc)" -gitlab_x86_64_bullseye_source_sha256="1c933d51068f67442de5b01d30869e0854c9199d24910cda43103d2fa49700b5" -gitlab_x86_64_buster_source_sha256="a91533c586e02441393fdb4560d5b7a9852beb339f683c26a9c85e098405e84c" +gitlab_x86_64_bullseye_source_sha256="da5a3eac413c2c1646bdec1fceed170fb0c77f4ebb61beae16fb2d84e3d14d63" +gitlab_x86_64_buster_source_sha256="f74e92fe2ebfc31d2b04aff606876cf3881912ef10ccf440ca74c486059f41dd" -gitlab_arm64_bullseye_source_sha256="90425b49427b46d8c5dbb09187baf76dbdf372f177f27d6e31b9717cd60849cc" -gitlab_arm64_buster_source_sha256="1393b8fb9498f4ead75aad69d89f9ba6e9281f3619f071f3efeebf72d2d6829f" +gitlab_arm64_bullseye_source_sha256="d6a660b057cf7621d6edd01458790b49582abe54d0e8b69024d37380d3d8a6ab" +gitlab_arm64_buster_source_sha256="370f54e6a14732397ecd050b3e582ee766cb43475c08da56516e77de20af1d1f" -gitlab_arm_buster_source_sha256="821bf4d6cf9f12373dc89d7ec757f3546a94a339ad5c1f044d102b9468e840b6" -gitlab_arm_bullseye_source_sha256="2bb0c4145d467c2d79a9067f090ace1b967318a49dc34e969d5abc06040d111e" +gitlab_arm_buster_source_sha256="0ce903f3bd83ee7aa5e12649422ce42f75700167564c008fa2a57f831c42f55e" +gitlab_arm_bullseye_source_sha256="ead7cec3a747d30ca20fb251f07c42636a86a3f35eae4d5ebebc8a20f8843832" architecture=$(ynh_app_setting_get --app="$app" --key=architecture)