diff options
| author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-09-20 15:23:00 +0100 | 
|---|---|---|
| committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-09-20 15:23:00 +0100 | 
| commit | ff7b545c8e462b909af92a5bea58de779c3f438b (patch) | |
| tree | bdd6a8bc3c8527df2925288348c752eb87d1b9ea /scripts | |
| parent | 55a7529621515eaeffa1424a281e639cf74be6cf (diff) | |
| parent | ff1deab6388dcb7f241205a1cd64eaddf1672753 (diff) | |
| download | gitlab-ce-ff7b545c8e462b909af92a5bea58de779c3f438b.tar.gz | |
Merge remote-tracking branch 'origin/master' into 18608-lock-issues
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/schema_changed.sh | 10 | ||||
| -rwxr-xr-x | scripts/trigger-build-docs | 45 | 
2 files changed, 41 insertions, 14 deletions
| diff --git a/scripts/schema_changed.sh b/scripts/schema_changed.sh new file mode 100644 index 00000000000..5de2b35571d --- /dev/null +++ b/scripts/schema_changed.sh @@ -0,0 +1,10 @@ +function schema_changed() { +  if [[ ! -z `git diff --name-only -- db/schema.rb` ]]; then +    echo "db/schema.rb after rake db:migrate:reset is different from one in the repository" +    exit 1 +  else +    echo "db/schema.rb after rake db:migrate:reset matches one in the repository" +  fi +} + +schema_changed diff --git a/scripts/trigger-build-docs b/scripts/trigger-build-docs index 44f832ed3e6..d3a9f5ff4ea 100755 --- a/scripts/trigger-build-docs +++ b/scripts/trigger-build-docs @@ -3,13 +3,6 @@  require 'gitlab'  # -# Give the remote branch a different name than the current one -# in order to avoid conflicts -# -@docs_branch = "#{ENV["CI_COMMIT_REF_SLUG"]}-built-from-ce-ee" -GITLAB_DOCS_REPO = 'gitlab-com/gitlab-docs'.freeze - -#  # Configure credentials to be used with gitlab gem  #  Gitlab.configure do |config| @@ -18,6 +11,26 @@ Gitlab.configure do |config|  end  # +# The remote docs project +# +GITLAB_DOCS_REPO = 'gitlab-com/gitlab-docs'.freeze + +# +# Truncate the remote docs branch name if it's more than 63 characters +# otherwise we hit the filesystem limit and the directory name where +# NGINX serves the site won't match the branch name. +# +def docs_branch +  # The maximum string length a file can have on a filesystem (ext4) +  # is 63 characters. Let's use something smaller to be 100% sure. +  max = 42 +  # Prefix the remote branch with 'preview-' in order to avoid +  # name conflicts in the rare case the branch name already +  # exists in the docs repo and truncate to max length. +  "preview-#{ENV["CI_COMMIT_REF_SLUG"]}"[0...max] +end + +#  # Dummy way to find out in which repo we are, CE or EE  #  def ee? @@ -28,18 +41,18 @@ end  # Create a remote branch in gitlab-docs  #  def create_remote_branch -  Gitlab.create_branch(GITLAB_DOCS_REPO, @docs_branch, 'master') -  puts "Remote branch '#{@docs_branch}' created" +  Gitlab.create_branch(GITLAB_DOCS_REPO, docs_branch, 'master') +  puts "Remote branch '#{docs_branch}' created"  rescue Gitlab::Error::BadRequest -  puts "Remote branch '#{@docs_branch}' already exists" +  puts "Remote branch '#{docs_branch}' already exists"  end  #  # Remove a remote branch in gitlab-docs  #  def remove_remote_branch -  Gitlab.delete_branch(GITLAB_DOCS_REPO, @docs_branch) -  puts "Remote branch '#{@docs_branch}' deleted" +  Gitlab.delete_branch(GITLAB_DOCS_REPO, docs_branch) +  puts "Remote branch '#{docs_branch}' deleted"  end  # @@ -50,11 +63,11 @@ def trigger_pipeline    param_name = ee? ? 'BRANCH_EE' : 'BRANCH_CE'    # The review app URL -  app_url = "http://#{@docs_branch}.#{ENV["DOCS_REVIEW_APPS_DOMAIN"]}/#{ee? ? 'ee' : 'ce'}" +  app_url = "http://#{docs_branch}.#{ENV["DOCS_REVIEW_APPS_DOMAIN"]}/#{ee? ? 'ee' : 'ce'}"    # Create the pipeline    puts "=> Triggering a pipeline..." -  pipeline = Gitlab.run_trigger(GITLAB_DOCS_REPO, ENV["DOCS_TRIGGER_TOKEN"], @docs_branch, { param_name => ENV["CI_COMMIT_REF_NAME"] }) +  pipeline = Gitlab.run_trigger(GITLAB_DOCS_REPO, ENV["CI_JOB_TOKEN"], docs_branch, { param_name => ENV["CI_COMMIT_REF_NAME"] })    puts "=> Pipeline created:"    puts "" @@ -77,4 +90,8 @@ when 'deploy'    trigger_pipeline  when 'cleanup'    remove_remote_branch +else +  puts "Please provide a valid option: +  deploy  - Creates the remote branch and triggers a pipeline +  cleanup - Deletes the remote branch and stops the Review App"  end | 
