diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba32354d10f58766898d22c69c6f0297643bb34e..f9ea8c122dce674533275d13f4db7eb842508114 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ stages: variables: CI_IMAGE: registry.gitlab.com/gitlab-org/gitlab-ci-multi-runner:ci-1.7 + GOROOT: /usr/local/go image: $CI_IMAGE diff --git a/Makefile b/Makefile index 6dd60cff92892c90b8a697039f02838957412337..10eac05daa1b696df10e12192f9b02f12a51db1c 100644 --- a/Makefile +++ b/Makefile @@ -357,10 +357,14 @@ release_packagecloud: # Releasing to https://packages.gitlab.com/runner/ @./ci/release_packagecloud "$$CI_JOB_NAME" -release_s3: prepare_index +release_s3: prepare_zoneinfo prepare_index # Releasing to S3 @./ci/release_s3 +prepare_zoneinfo: + # preparing the zoneinfo file + @cp $$GOROOT/lib/time/zoneinfo.zip out/ + prepare_index: # Preparing index file @./ci/prepare_index diff --git a/docs/faq/README.md b/docs/faq/README.md index ddfd9524a61d96852f0a053275d6f9033d82e578..f1e4af9dcfe25d7377fe662fd7687c03f93b29ff 100644 --- a/docs/faq/README.md +++ b/docs/faq/README.md @@ -225,3 +225,70 @@ and the service should be started properly. [microsoft-manually-set-seservicelogonright]: https://technet.microsoft.com/en-us/library/dn221981 [microsoft-ntrights-download]: https://www.microsoft.com/en-us/download/details.aspx?id=17657 [microsoft-ntrights-usage-on-win7]: https://technet.microsoft.com/en-us/library/dd548356(WS.10).aspx + +## 14. `zoneinfo.zip: no such file or directory` error when using `OffPeakTimezone` + +In `v1.11.0` we've added a possibility to configure timezone in which `OffPeakPeriods` +are described. The feature should work on most Unix systems out of the box. However on some +Unix systems, and probably on most non-Unix systems (including Windows, for which we're providing +Runner's binaries), when used it will crash Runner at start with an error similar to: + +``` +Failed to load config Invalid OffPeakPeriods value: open /usr/local/go/lib/time/zoneinfo.zip: no such file or directory +``` + +The error is caused by `time` package in Go. Go uses the IANA Time Zone database to load +configuration of specified timezone. On most Unix systems this database is already present on +one of well-known paths (`/usr/share/zoneinfo`, `/usr/share/lib/zoneinfo`, `/usr/lib/locale/TZ/`). +Go's `time` package looks for the Time Zone database in all three paths. If it will not find any +of them, but the machine has a configured Go development environment (with a proper `$GOPATH` +present for Runner's process) then it will fallback to the `$GOROOT/lib/time/zoneinfo.zip` file. + +If none of these path is present (for example on a production Windows host) the above error is thrown. + +In case if your system has support for IANA Time Zone database, but it's not available by default, you +can try to install it. For Linux systems it can be done for example by: + +```bash +# on Debian/Ubuntu based systems +root@host:# apt-get install tzdata + +# on RPM based systems +root@host:# yum install tzdata + +# on Linux Alpine +root@host:# apk add -U tzdata +``` + +If your system doesn't provide this database in a _native_ way, then you can make `OffPeakTimezone` +working by: + +1. Downloading the [`zoneinfo.zip`][zoneinfo-file]. Starting with version v9.1.0 you can download + the file from a tagged path. In that case you should replace `latest` with the tag name (e.g. `v9.1.0`) + in the `zoneinfo.zip` download URL. + +1. Store this file in a well known directory. We're suggesting to use the same directory where + the `config.toml` file is present. So for example, if you're hosting Runner on Windows machine + and your config file is stored at `C:\gitlab-runner\config.toml` then save the `zoneinfo.zip` + at `C:\gitlab-runner\zoneinfo.zip`. + +1. Set the `ZONEINFO` environment variable containing a full path to the `zoneinfo.zip` file. If you + are starting Runner using the `run` command, then you can do this by: + + ```bash + $ ZONEINFO=/etc/gitlab-runner/zoneinfo.zip gitlab-runner run [other options ...] + ``` + + or + + ```powershell + C:\gitlab-runner> set ZONEINFO=C:\gitlab-runner\zoneinfo.zip + C:\gitlab-runner> gitlab-runner run [other options ...] + ``` + + If you are starting Runner as a system service then you will need to update/override + service configuration in a way that is provided by your service manager software + (unix systems) or by adding the `ZONEINFO` variable to the list of environment variables + available for Runner's user through System Settings (Windows). + +[zoneinfo-file]: https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/zoneinfo.zip \ No newline at end of file