This article is published under a SIGNATURE 4.0 International (CC BY 4.0) license. Signature 4.0 International (CC BY 4.0)
Author: Su Yang
Creation time: August 4, 2020 statistical word count: 4450 words reading time: 9 minutes to read this article links: soulteary.com/2020/08/04/…
GitLab 12 was upgraded across version 13
I thought the GitLab Concise Maintenance Guide (V2020.05) was enough to solve all the following problems, but in v12, GitLab officially introduced the “upgrade extra action” step due to some changes.
In other words, the normal mode of changing the lower version of the application to the higher version, while the Ruby upgrade script performs the upgrade, is not fully effective.
There are also some minor additional issues during the upgrade process, so let’s talk about how to upgrade an application in the context of “upgrade extra operations.”
Writing in the front
Because we are using the container scheme, the upgrade is relatively easy. If you haven’t built GitLab yet, refer to the GitLab TAB in previous articles.
Confirming the Upgrade Route
There are several different roadmaps, each with some key updates.
Target version 13.2.0
If the current version is greater than or equal to 11.5.0, the upgrade path is as follows:
11.5.0 - > 11.11.8 - > 12.0.12 - > 12.10.6 - > 13.0.0 - > 13.2.0Copy the code
11.11, 12.0, 12.10, and 13.0 are required.
Target version 13.0.1
If the current version is greater than or equal to 11.10.8, the upgrade path is as follows:
11.10.5 - > 11.11.8 - > 12.0.12 - > 12.10.6 - > 13.0.1Copy the code
11.11, 12.0, and 12.10 are required.
Target version 12.10.6
If the current version is greater than or equal to 11.3.4, the upgrade path is as follows:
11.3.4 - > 11.11.8 - > 12.0.12 - > 12.10.6Copy the code
11.11 and 12.0 are required.
Target version 12.9.5
If the current version is greater than or equal to 10.4.5, the upgrade path is as follows:
10.4.5 - > 10.8.7 - > 11.11.8 - > 12.0.12 - > 12.9.5Copy the code
10.8, 11.11, 12.0, and 12.9.5 are required.
Target version 12.2.5
If the current version is greater than 9.2.6, the upgrade path is as follows:
9.2.6 - > 9.5.10 - > 10.8.7 - > 11.11.8 - > 12.0.12 - > 12.2.5Copy the code
Among them, 9.5, 10.8, 11.11, 12.0, and 12.2 are required.
Upgrade practice
After the upgrade path is specified, you only need to follow the upgrade path to troubleshoot various problems. After the upgrade is successful, logs similar to the following are displayed.
Recipe: gitlab::gitlab-workhorse
* runit_service[gitlab-workhorse] action restart (up to date)
Recipe: gitlab::gitlab-pages
* runit_service[gitlab-pages] action restart (up to date)
Running handlers:
Running handlers complete
Chef Client finished, 259/810 resources updated in 01 minutes 18 seconds
gitlab Reconfigured!
Checking for an omnibus managed postgresql: OK
Checking if postgresql['version'] is set: OK
Checking if we already upgraded: OK
Copy the code
So let’s talk about some of the problems you might have.
Episode 1: Incorrect upgrade version designation
When I first upgraded, I didn’t realize that the V12 version had so many “nicepoints”, so I changed the ** gitlab/ Gitlab-CE: 12.10.3-CE.0 that I was currently using to the latest Gitlab/Gitlab-CE: 13.2.2-CE.0 **, as expected, encountered a number of incompatibility issues.
Fortunately, the program has an exception check, judged that the version does not meet the requirements, did not allow the execution of the upgrade operation, kept output similar to the following log, prompting us to check the upgrade document.
Thank you for using GitLab Docker Image! Current version: Gitlab-ce =13.2.2-ce.0 Configure gitlab for your system by editing /etc/gitlab/gitlab.rb file And restart this container to reload settings. To do it use docker exec: docker exec -it gitlab vim /etc/gitlab/gitlab.rb docker restart gitlab For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.comdock /gitlab-org/omnibus-gitlab/blob/master/README.md If this container fails to start due to permission problems try to fix it by executing: docker exec -it gitlab update-permissions docker restart gitlab Cleaning stale PIDs & sockets It seems you are upgrading From Major version 12 to Major version 13. It is required to upgrade to the latest 13.0.x version first before proceeding. Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrading-major-versions Thank you for using GitLab Docker Image! Current version: Gitlab-ce =13.2.2-ce.0 Configure gitlab for your system by editing /etc/gitlab/gitlab.rb file And restart this container to reload settings. To do it use docker exec: docker exec -it gitlab vim /etc/gitlab/gitlab.rb docker restart gitlab ... . Cleaning stale PIDs & sockets It seems you are upgrading from major version 12 to major version 13. It is required to X version first before proceeding. Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrading-major-versions gitlab.lab.com exited with code 1Copy the code
No problem, according to the official route modified version of the upgrade can be. Of course, it is recommended that you perform a full backup of your data.
Episode 2: Program generation configuration error
In a container environment, the ** gitlab.rb** configuration is automatically generated by the program reading the environment variable. Because of cross-version, the configuration here may mix the contents of multiple versions, resulting in version incompatibilities.
The actual run will encounter an error like this:
Recipe Compile Error in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/default.rb
Copy the code
The solution is simply to have the program generate a new configuration in a working version.
cd /etc/gitlab
mv gitlab.rb gitlab.rb.bak
touch gitlab.rb
gitlab-ctl reconfigure
Copy the code
Episode 3: Unsupported environment variable configuration items
When reading environment variables, it is possible to encounter some configuration items that have been deprecated and cause runtime exceptions, such as the following:
Mixlib::Config::UnknownConfigOptionError
----------------------------------------
Reading unsupported config value gitlab_monitor.
Copy the code
Solution: Remove or comment out unsupported configuration items in the prompt.
For example # gitlab_monitor[‘enable’] = false.
Episode 4: GitLab CI Shell mode stopped working
After the upgrade, some Shell mode CI stops working.
Running with gitlab-runner 13.2.2 (a998cacd)
on ubuntu-basic-18-04 tUfFiKLG
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:00
Running on ubuntu-basic-18-04...
ERROR: Job failed (system failure): prepare environment: exit status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Copy the code
This is because the new version of GitLab will send the –login parameter when calling CI, and if the user directory contains.bashrc and.bash_logout files, it will be loaded and executed, and these files may contain some unexpected commands to exit the execution process. For example,.bash_logout might have the following content.
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
Copy the code
Solution: Delete or comment out the content.
The last
I’m going to stop here.
–EOF
I now have a small toss group, which gathered some like to toss small partners.
In the case of no advertisement, we will talk about software, HomeLab and some programming problems together, and also share some technical salon information in the group from time to time.
Like to toss small partners welcome to scan code to add friends. (Please specify source and purpose, otherwise it will not be approved)
All this stuff about getting into groups