From 7e3ff5a0beb64ca076f7e0af1d07e3c99775e426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 21 Jul 2017 15:54:58 +0200 Subject: Retrieve and sync flaky specs report from and to S3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/detect-new-flaky-examples | 21 +++++++++++++++++++++ scripts/merge-reports | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 scripts/detect-new-flaky-examples (limited to 'scripts') diff --git a/scripts/detect-new-flaky-examples b/scripts/detect-new-flaky-examples new file mode 100755 index 00000000000..3bee4f9a34b --- /dev/null +++ b/scripts/detect-new-flaky-examples @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +require 'json' + +report_file = ARGV.shift +unless report_file + puts 'usage: detect-new-flaky-examples ' + exit 1 +end + +puts "Loading #{report_file}..." +report = JSON.parse(File.read(report_file)) + +if report.any? + puts "New flaky examples were detected!\n" + puts JSON.pretty_generate(report) + exit 1 +else + puts "No new flaky examples detected.\n" + exit 0 +end diff --git a/scripts/merge-reports b/scripts/merge-reports index aad76bcc327..3a421f1f1fc 100755 --- a/scripts/merge-reports +++ b/scripts/merge-reports @@ -4,7 +4,7 @@ require 'json' main_report_file = ARGV.shift unless main_report_file - puts 'usage: merge_reports [extra reports...]' + puts 'usage: merge-reports [extra reports...]' exit 1 end -- cgit v1.2.1 From b2178c1d851411bb2d630246f45541cd1bceecc7 Mon Sep 17 00:00:00 2001 From: Markus Koller Date: Thu, 31 Aug 2017 00:39:21 +0000 Subject: Upgrade mail and nokogiri gems due to security issues --- scripts/static-analysis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/static-analysis b/scripts/static-analysis index e4f80e8fc6f..52529e64b30 100755 --- a/scripts/static-analysis +++ b/scripts/static-analysis @@ -3,7 +3,7 @@ require ::File.expand_path('../lib/gitlab/popen', __dir__) tasks = [ - %w[bundle exec bundle-audit check --update --ignore CVE-2016-4658 CVE-2017-5029], + %w[bundle exec bundle-audit check --update], %w[bundle exec rake config_lint], %w[bundle exec rake flay], %w[bundle exec rake haml_lint], -- cgit v1.2.1 From bde39322f1b0a24b03c949abbf34b21859f9a5c0 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 20 Jul 2017 17:32:17 +0200 Subject: Add a linter for PO files --- scripts/static-analysis | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/static-analysis b/scripts/static-analysis index 52529e64b30..295b6f132c1 100755 --- a/scripts/static-analysis +++ b/scripts/static-analysis @@ -12,7 +12,8 @@ tasks = [ %w[bundle exec license_finder], %w[yarn run eslint], %w[bundle exec rubocop --require rubocop-rspec], - %w[scripts/lint-conflicts.sh] + %w[scripts/lint-conflicts.sh], + %w[bundle exec rake gettext:lint] ] failed_tasks = tasks.reduce({}) do |failures, task| -- cgit v1.2.1 From ecdab9f96f5ab94292b52010618847e88e8573fd Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Thu, 7 Sep 2017 15:43:20 +0000 Subject: Add script and job to trigger a docs build --- scripts/trigger-build | 27 --------------- scripts/trigger-build-docs | 80 +++++++++++++++++++++++++++++++++++++++++++ scripts/trigger-build-omnibus | 27 +++++++++++++++ 3 files changed, 107 insertions(+), 27 deletions(-) delete mode 100755 scripts/trigger-build create mode 100755 scripts/trigger-build-docs create mode 100755 scripts/trigger-build-omnibus (limited to 'scripts') diff --git a/scripts/trigger-build b/scripts/trigger-build deleted file mode 100755 index dcda70d7ed8..00000000000 --- a/scripts/trigger-build +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env ruby - -require 'net/http' -require 'json' - -uri = URI('https://gitlab.com/api/v4/projects/20699/trigger/pipeline') -params = { - "ref" => ENV["OMNIBUS_BRANCH"] || "master", - "token" => ENV["BUILD_TRIGGER_TOKEN"], - "variables[GITLAB_VERSION]" => ENV["CI_COMMIT_SHA"], - "variables[ALTERNATIVE_SOURCES]" => true, - "variables[ee]" => ENV["EE_PACKAGE"] || "false" -} - -Dir.glob("*_VERSION").each do |version_file| - params["variables[#{version_file}]"] = File.read(version_file).strip -end - -res = Net::HTTP.post_form(uri, params) -pipeline_id = JSON.parse(res.body)['id'] - -unless pipeline_id.nil? - puts "Triggered pipeline can be found at https://gitlab.com/gitlab-org/omnibus-gitlab/pipelines/#{pipeline_id}" -else - puts "Trigger failed. The response from trigger is: " - puts res.body -end diff --git a/scripts/trigger-build-docs b/scripts/trigger-build-docs new file mode 100755 index 00000000000..e58edf189cf --- /dev/null +++ b/scripts/trigger-build-docs @@ -0,0 +1,80 @@ +#!/usr/bin/env ruby + +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' + +# +# Configure credentials to be used with gitlab gem +# +Gitlab.configure do |config| + config.endpoint = 'https://gitlab.com/api/v4' + config.private_token = ENV["DOCS_API_TOKEN"] # GitLab Docs bot access token which has only Developer access to gitlab-docs +end + +# +# Dummy way to find out in which repo we are, CE or EE +# +def is_ee? + File.exists?('CHANGELOG-EE.md') +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" +rescue Gitlab::Error::BadRequest => e + 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" +end + +# +# Trigger a pipeline in gitlab-docs +# +def trigger_pipeline + # Overriding vars in https://gitlab.com/gitlab-com/gitlab-docs/blob/master/.gitlab-ci.yml + param_name = is_ee? ? 'BRANCH_EE' : 'BRANCH_CE' + + # The review app URL + app_url = "http://#{@docs_branch}.#{ENV["DOCS_REVIEW_APPS_DOMAIN"]}/#{is_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"] }) + + puts "=> Pipeline created:" + puts "" + puts "https://gitlab.com/gitlab-com/gitlab-docs/pipelines/#{pipeline.id}" + puts "" + puts "=> Preview your changes live at:" + puts "" + puts app_url + puts "" +end + +# +# When the first argument is deploy then create the branch and trigger pipeline +# When it is 'stop', it deleted the remote branch. That way, we ensure there +# are no stale remote branches and the Review server doesn't fill. +# +case ARGV[0] +when 'deploy' + create_remote_branch + trigger_pipeline +when 'cleanup' + remove_remote_branch +end diff --git a/scripts/trigger-build-omnibus b/scripts/trigger-build-omnibus new file mode 100755 index 00000000000..dcda70d7ed8 --- /dev/null +++ b/scripts/trigger-build-omnibus @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby + +require 'net/http' +require 'json' + +uri = URI('https://gitlab.com/api/v4/projects/20699/trigger/pipeline') +params = { + "ref" => ENV["OMNIBUS_BRANCH"] || "master", + "token" => ENV["BUILD_TRIGGER_TOKEN"], + "variables[GITLAB_VERSION]" => ENV["CI_COMMIT_SHA"], + "variables[ALTERNATIVE_SOURCES]" => true, + "variables[ee]" => ENV["EE_PACKAGE"] || "false" +} + +Dir.glob("*_VERSION").each do |version_file| + params["variables[#{version_file}]"] = File.read(version_file).strip +end + +res = Net::HTTP.post_form(uri, params) +pipeline_id = JSON.parse(res.body)['id'] + +unless pipeline_id.nil? + puts "Triggered pipeline can be found at https://gitlab.com/gitlab-org/omnibus-gitlab/pipelines/#{pipeline_id}" +else + puts "Trigger failed. The response from trigger is: " + puts res.body +end -- cgit v1.2.1 From a501feb4fb9bee2317c2bdfe627ff8c5242771a4 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 7 Sep 2017 13:21:47 -0400 Subject: Resolve RuboCop violations in scripts/trigger-build-docs --- scripts/trigger-build-docs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/trigger-build-docs b/scripts/trigger-build-docs index e58edf189cf..44f832ed3e6 100755 --- a/scripts/trigger-build-docs +++ b/scripts/trigger-build-docs @@ -7,7 +7,7 @@ require 'gitlab' # in order to avoid conflicts # @docs_branch = "#{ENV["CI_COMMIT_REF_SLUG"]}-built-from-ce-ee" -GITLAB_DOCS_REPO = 'gitlab-com/gitlab-docs' +GITLAB_DOCS_REPO = 'gitlab-com/gitlab-docs'.freeze # # Configure credentials to be used with gitlab gem @@ -20,8 +20,8 @@ end # # Dummy way to find out in which repo we are, CE or EE # -def is_ee? - File.exists?('CHANGELOG-EE.md') +def ee? + File.exist?('CHANGELOG-EE.md') end # @@ -30,7 +30,7 @@ end def create_remote_branch Gitlab.create_branch(GITLAB_DOCS_REPO, @docs_branch, 'master') puts "Remote branch '#{@docs_branch}' created" -rescue Gitlab::Error::BadRequest => e +rescue Gitlab::Error::BadRequest puts "Remote branch '#{@docs_branch}' already exists" end @@ -47,10 +47,10 @@ end # def trigger_pipeline # Overriding vars in https://gitlab.com/gitlab-com/gitlab-docs/blob/master/.gitlab-ci.yml - param_name = is_ee? ? 'BRANCH_EE' : 'BRANCH_CE' + param_name = ee? ? 'BRANCH_EE' : 'BRANCH_CE' # The review app URL - app_url = "http://#{@docs_branch}.#{ENV["DOCS_REVIEW_APPS_DOMAIN"]}/#{is_ee? ? 'ee' : 'ce'}" + app_url = "http://#{@docs_branch}.#{ENV["DOCS_REVIEW_APPS_DOMAIN"]}/#{ee? ? 'ee' : 'ce'}" # Create the pipeline puts "=> Triggering a pipeline..." -- cgit v1.2.1