diff options
36 files changed, 105 insertions, 19 deletions
diff --git a/CHANGELOG b/CHANGELOG index 79d4b5f94c8..6985c1fa46e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -76,6 +76,7 @@ v 8.4.0 (unreleased) - Fix: Creator should be added as a master of the project on creation - Added X-GitLab-... headers to emails from CI and Email On Push services (Anton Baklanov) - Add IP check against DNSBLs at account sign-up + - Added cache:key to .gitlab-ci.yml allowing to fine tune the caching v 8.3.4 - Use gitlab-workhorse 0.5.4 (fixes API routing bug) diff --git a/GITLAB_WORKHORSE_VERSION b/GITLAB_WORKHORSE_VERSION index a918a2aa18d..ee6cdce3c29 100644 --- a/GITLAB_WORKHORSE_VERSION +++ b/GITLAB_WORKHORSE_VERSION @@ -1 +1 @@ -0.6.0 +0.6.1 diff --git a/Rakefile b/Rakefile index 35b2f05cbb4..35b2f05cbb4 100644..100755 --- a/Rakefile +++ b/Rakefile diff --git a/app/assets/fonts/OFL.txt b/app/assets/fonts/OFL.txt index df187637e18..df187637e18 100755..100644 --- a/app/assets/fonts/OFL.txt +++ b/app/assets/fonts/OFL.txt diff --git a/app/assets/fonts/SourceSansPro-Black.ttf.woff b/app/assets/fonts/SourceSansPro-Black.ttf.woff Binary files differindex b7e86200927..b7e86200927 100755..100644 --- a/app/assets/fonts/SourceSansPro-Black.ttf.woff +++ b/app/assets/fonts/SourceSansPro-Black.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-Black.ttf.woff2 b/app/assets/fonts/SourceSansPro-Black.ttf.woff2 Binary files differindex c90d078406c..c90d078406c 100755..100644 --- a/app/assets/fonts/SourceSansPro-Black.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-Black.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff b/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff Binary files differindex c3314b1ef06..c3314b1ef06 100755..100644 --- a/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff +++ b/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff2 b/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff2 Binary files differindex b87e22c41b5..b87e22c41b5 100755..100644 --- a/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-BlackIt.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-Bold.ttf.woff b/app/assets/fonts/SourceSansPro-Bold.ttf.woff Binary files differindex d1d40f840f8..d1d40f840f8 100755..100644 --- a/app/assets/fonts/SourceSansPro-Bold.ttf.woff +++ b/app/assets/fonts/SourceSansPro-Bold.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-Bold.ttf.woff2 b/app/assets/fonts/SourceSansPro-Bold.ttf.woff2 Binary files differindex 0f46f3e833a..0f46f3e833a 100755..100644 --- a/app/assets/fonts/SourceSansPro-Bold.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-Bold.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff b/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff Binary files differindex ef6ff514d3a..ef6ff514d3a 100755..100644 --- a/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff +++ b/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff2 b/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff2 Binary files differindex 8007df6df32..8007df6df32 100755..100644 --- a/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-BoldIt.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff b/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff Binary files differindex 1e6c94d9eb3..1e6c94d9eb3 100755..100644 --- a/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff +++ b/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff2 b/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff2 Binary files differindex b715f274082..b715f274082 100755..100644 --- a/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-ExtraLight.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff b/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff Binary files differindex 7a408b1ec73..7a408b1ec73 100755..100644 --- a/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff +++ b/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff2 b/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff2 Binary files differindex d8f9d29d4aa..d8f9d29d4aa 100755..100644 --- a/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-ExtraLightIt.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-It.ttf.woff b/app/assets/fonts/SourceSansPro-It.ttf.woff Binary files differindex 4d54bc95718..4d54bc95718 100755..100644 --- a/app/assets/fonts/SourceSansPro-It.ttf.woff +++ b/app/assets/fonts/SourceSansPro-It.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-It.ttf.woff2 b/app/assets/fonts/SourceSansPro-It.ttf.woff2 Binary files differindex a00852641f8..a00852641f8 100755..100644 --- a/app/assets/fonts/SourceSansPro-It.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-It.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-Light.ttf.woff b/app/assets/fonts/SourceSansPro-Light.ttf.woff Binary files differindex 1706d57d3c5..1706d57d3c5 100755..100644 --- a/app/assets/fonts/SourceSansPro-Light.ttf.woff +++ b/app/assets/fonts/SourceSansPro-Light.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-Light.ttf.woff2 b/app/assets/fonts/SourceSansPro-Light.ttf.woff2 Binary files differindex d8b610ad76e..d8b610ad76e 100755..100644 --- a/app/assets/fonts/SourceSansPro-Light.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-Light.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-LightIt.ttf.woff b/app/assets/fonts/SourceSansPro-LightIt.ttf.woff Binary files differindex 87378d6c609..87378d6c609 100755..100644 --- a/app/assets/fonts/SourceSansPro-LightIt.ttf.woff +++ b/app/assets/fonts/SourceSansPro-LightIt.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-LightIt.ttf.woff2 b/app/assets/fonts/SourceSansPro-LightIt.ttf.woff2 Binary files differindex e0eebac8273..e0eebac8273 100755..100644 --- a/app/assets/fonts/SourceSansPro-LightIt.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-LightIt.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-Regular.ttf.woff b/app/assets/fonts/SourceSansPro-Regular.ttf.woff Binary files differindex 460ab12a638..460ab12a638 100755..100644 --- a/app/assets/fonts/SourceSansPro-Regular.ttf.woff +++ b/app/assets/fonts/SourceSansPro-Regular.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-Regular.ttf.woff2 b/app/assets/fonts/SourceSansPro-Regular.ttf.woff2 Binary files differindex 0dd3464c74b..0dd3464c74b 100755..100644 --- a/app/assets/fonts/SourceSansPro-Regular.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-Regular.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-Semibold.ttf.woff b/app/assets/fonts/SourceSansPro-Semibold.ttf.woff Binary files differindex 43379631b2d..43379631b2d 100755..100644 --- a/app/assets/fonts/SourceSansPro-Semibold.ttf.woff +++ b/app/assets/fonts/SourceSansPro-Semibold.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-Semibold.ttf.woff2 b/app/assets/fonts/SourceSansPro-Semibold.ttf.woff2 Binary files differindex 2526d2e1b60..2526d2e1b60 100755..100644 --- a/app/assets/fonts/SourceSansPro-Semibold.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-Semibold.ttf.woff2 diff --git a/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff b/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff Binary files differindex 232c2048ae7..232c2048ae7 100755..100644 --- a/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff +++ b/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff diff --git a/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff2 b/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff2 Binary files differindex 606935af089..606935af089 100755..100644 --- a/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff2 +++ b/app/assets/fonts/SourceSansPro-SemiboldIt.ttf.woff2 diff --git a/config/initializers/metrics.rb b/config/initializers/metrics.rb index b1fe36dc21c..0945b93ed5d 100644 --- a/config/initializers/metrics.rb +++ b/config/initializers/metrics.rb @@ -49,6 +49,7 @@ if Gitlab::Metrics.enabled? config.instrument_instance_methods(Gitlab::Shell) config.instrument_methods(Gitlab::Git) + config.instrument_instance_methods(Gitlab::Git::Repository) Gitlab::Git.constants.each do |name| const = Gitlab::Git.const_get(name) diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index fd0d49de4e4..3b594df659d 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -135,10 +135,9 @@ thus allowing to fine tune them. ### cache `cache` is used to specify a list of files and directories which should be -cached between builds. Caches are stored according to the branch/ref and the -job name. They are not currently shared between different job names or between -branches/refs, which means that caching will benefit you if you push subsequent -commits to an existing feature branch. +cached between builds. + +**By default the caching is enabled per-job and per-branch.** If `cache` is defined outside the scope of the jobs, it means it is set globally and all jobs will use its definition. @@ -152,6 +151,59 @@ cache: - binaries/ ``` +#### cache:key + +_**Note:** Introduced in GitLab Runner v1.0.0._ + +The `key` directive allows you to define the affinity of caching +between jobs, allowing to have a single cache for all jobs, +cache per-job, cache per-branch or any other way you deem proper. + +This allows you to fine tune caching, allowing you to cache data between different jobs or even different branches. +The `cache:key` variable can use any of the [predefined variables](../variables/README.md): + +Example configurations: + +To enable per-job caching: + + ```yaml + cache: + key: "$CI_BUILD_NAME" + untracked: true + ``` + +To enable per-branch caching: + + ```yaml + cache: + key: "$CI_BUILD_REF_NAME" + untracked: true + ``` + +To enable per-job and per-branch caching: + + ```yaml + cache: + key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME" + untracked: true + ``` + +To enable per-branch and per-stage caching: + + ```yaml + cache: + key: "$CI_BUILD_STAGE/$CI_BUILD_REF_NAME" + untracked: true + ``` + +If you use **Windows Batch** to run your shell scripts you need to replace the `$` with `%`: + + ```yaml + cache: + key: "%CI_BUILD_STAGE%/%CI_BUILD_REF_NAME%" + untracked: true + ``` + ## Jobs `.gitlab-ci.yml` allows you to specify an unlimited number of jobs. Each job diff --git a/doc/update/8.3-to-8.4.md b/doc/update/8.3-to-8.4.md index 604939cd733..bf80f66d004 100644 --- a/doc/update/8.3-to-8.4.md +++ b/doc/update/8.3-to-8.4.md @@ -48,7 +48,7 @@ which should already be on your system from GitLab 8.1. ```bash cd /home/git/gitlab-workhorse sudo -u git -H git fetch --all -sudo -u git -H git checkout 0.6.0 +sudo -u git -H git checkout 0.6.1 sudo -u git -H make ``` @@ -104,10 +104,7 @@ via [/etc/default/gitlab]. #### Init script -We updated the init script for GitLab in order to pass new -configuration options to gitlab-workhorse. We let gitlab-workhorse -connect to the Rails application via a Unix domain socket and we tell -it where the 'public' directory of GitLab is. +We updated the init script for GitLab in order to set a specific PATH for gitlab-workhorse. ``` cd /home/git/gitlab diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index bcdfd38d292..1a3f662811a 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -115,6 +115,10 @@ module Ci end if @cache + if @cache[:key] && !validate_string(@cache[:key]) + raise ValidationError, "cache:key parameter should be a string" + end + if @cache[:untracked] && !validate_boolean(@cache[:untracked]) raise ValidationError, "cache:untracked parameter should be an boolean" end @@ -198,6 +202,10 @@ module Ci end def validate_job_cache!(name, job) + if job[:cache][:key] && !validate_string(job[:cache][:key]) + raise ValidationError, "#{name} job: cache:key parameter should be a string" + end + if job[:cache][:untracked] && !validate_boolean(job[:cache][:untracked]) raise ValidationError, "#{name} job: cache:untracked parameter should be an boolean" end diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb index 18929b9113b..663402e8197 100644 --- a/lib/gitlab/github_import/importer.rb +++ b/lib/gitlab/github_import/importer.rb @@ -82,8 +82,12 @@ module Gitlab end true - rescue Gitlab::Shell::Error - false + rescue Gitlab::Shell::Error => e + if e.message =~ /repository not exported/ + true + else + false + end end end end diff --git a/lib/support/init.d/gitlab b/lib/support/init.d/gitlab index c5f07c8b508..1633891c8a0 100755 --- a/lib/support/init.d/gitlab +++ b/lib/support/init.d/gitlab @@ -38,6 +38,7 @@ web_server_pid_path="$pid_path/unicorn.pid" sidekiq_pid_path="$pid_path/sidekiq.pid" mail_room_enabled=false mail_room_pid_path="$pid_path/mail_room.pid" +gitlab_workhorse_dir=$(cd $app_root/../gitlab-workhorse && pwd) gitlab_workhorse_pid_path="$pid_path/gitlab-workhorse.pid" gitlab_workhorse_options="-listenUmask 0 -listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080 -authSocket $rails_socket -documentRoot $app_root/public" gitlab_workhorse_log="$app_root/log/gitlab-workhorse.log" @@ -233,10 +234,12 @@ start_gitlab() { if [ "$gitlab_workhorse_status" = "0" ]; then echo "The gitlab-workhorse is already running with pid $spid, not restarting" else - # No need to remove a socket, gitlab-workhorse does this itself + # No need to remove a socket, gitlab-workhorse does this itself. + # Because gitlab-workhorse has multiple executables we need to fix + # the PATH. $app_root/bin/daemon_with_pidfile $gitlab_workhorse_pid_path \ - $app_root/../gitlab-workhorse/gitlab-workhorse \ - $gitlab_workhorse_options \ + /usr/bin/env PATH=$gitlab_workhorse_dir:$PATH \ + gitlab-workhorse $gitlab_workhorse_options \ >> $gitlab_workhorse_log 2>&1 & fi diff --git a/lib/support/init.d/gitlab.default.example b/lib/support/init.d/gitlab.default.example index 1937ca582b0..4e6e56ac2db 100755 --- a/lib/support/init.d/gitlab.default.example +++ b/lib/support/init.d/gitlab.default.example @@ -30,6 +30,9 @@ web_server_pid_path="$pid_path/unicorn.pid" # The default is "$pid_path/sidekiq.pid" sidekiq_pid_path="$pid_path/sidekiq.pid" +# The directory where the gitlab-workhorse binaries are. Usually +# /home/git/gitlab-workhorse . +gitlab_workhorse_dir=$(cd $app_root/../gitlab-workhorse && pwd) gitlab_workhorse_pid_path="$pid_path/gitlab-workhorse.pid" # The -listenXxx settings determine where gitlab-workhorse # listens for connections from NGINX. To listen on localhost:8181, write diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index d15100fc6d8..f3394910c5b 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -336,7 +336,7 @@ module Ci describe "Caches" do it "returns cache when defined globally" do config = YAML.dump({ - cache: { paths: ["logs/", "binaries/"], untracked: true }, + cache: { paths: ["logs/", "binaries/"], untracked: true, key: 'key' }, rspec: { script: "rspec" } @@ -348,13 +348,14 @@ module Ci expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq( paths: ["logs/", "binaries/"], untracked: true, + key: 'key', ) end it "returns cache when defined in a job" do config = YAML.dump({ rspec: { - cache: { paths: ["logs/", "binaries/"], untracked: true }, + cache: { paths: ["logs/", "binaries/"], untracked: true, key: 'key' }, script: "rspec" } }) @@ -365,15 +366,16 @@ module Ci expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq( paths: ["logs/", "binaries/"], untracked: true, + key: 'key', ) end it "overwrite cache when defined for a job and globally" do config = YAML.dump({ - cache: { paths: ["logs/", "binaries/"], untracked: true }, + cache: { paths: ["logs/", "binaries/"], untracked: true, key: 'global' }, rspec: { script: "rspec", - cache: { paths: ["test/"], untracked: false }, + cache: { paths: ["test/"], untracked: false, key: 'local' }, } }) @@ -383,6 +385,7 @@ module Ci expect(config_processor.builds_for_stage_and_ref("test", "master").first[:options][:cache]).to eq( paths: ["test/"], untracked: false, + key: 'local', ) end end @@ -615,6 +618,20 @@ module Ci end.to raise_error(GitlabCiYamlProcessor::ValidationError, "cache:paths parameter should be an array of strings") end + it "returns errors if cache:key is not a string" do + config = YAML.dump({ cache: { key: 1 }, rspec: { script: "test" } }) + expect do + GitlabCiYamlProcessor.new(config) + end.to raise_error(GitlabCiYamlProcessor::ValidationError, "cache:key parameter should be a string") + end + + it "returns errors if job cache:key is not an a string" do + config = YAML.dump({ types: ["build", "test"], rspec: { script: "test", cache: { key: 1 } } }) + expect do + GitlabCiYamlProcessor.new(config) + end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: cache:key parameter should be a string") + end + it "returns errors if job cache:untracked is not an array of strings" do config = YAML.dump({ types: ["build", "test"], rspec: { script: "test", cache: { untracked: "string" } } }) expect do |