diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 12:09:46 +0300 |
commit | 221b529789f4090341a825695aeb49b8df6dd11d (patch) | |
tree | c8843e4ca5ef1034752eb68712fcf338b24950db /lib/gitlab | |
parent | 00a8c64ffd18e74df4b1cdeda7776b5221fddafe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml | 2 | ||||
-rw-r--r-- | lib/gitlab/static_site_editor/config.rb | 26 |
2 files changed, 22 insertions, 6 deletions
diff --git a/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml b/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml index ecca1731579..a41b399032f 100644 --- a/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Deploy-ECS.gitlab-ci.yml @@ -9,7 +9,7 @@ include: - template: Jobs/Build.gitlab-ci.yml .deploy_to_ecs: - image: registry.gitlab.com/gitlab-org/cloud-deploy:latest + image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-ecs:latest script: - ecs update-task-definition diff --git a/lib/gitlab/static_site_editor/config.rb b/lib/gitlab/static_site_editor/config.rb index 4bc0fc95abd..41d54ee0a92 100644 --- a/lib/gitlab/static_site_editor/config.rb +++ b/lib/gitlab/static_site_editor/config.rb @@ -3,33 +3,49 @@ module Gitlab module StaticSiteEditor class Config + SUPPORTED_EXTENSIONS = %w[.md].freeze + def initialize(repository, ref, file_path, return_url) @repository = repository @ref = ref @file_path = file_path @return_url = return_url + @commit_id = repository.commit(ref)&.id if ref end def payload { branch: ref, path: file_path, - commit: commit.id, + commit_id: commit_id, project_id: project.id, project: project.path, namespace: project.namespace.path, - return_url: return_url + return_url: return_url, + is_supported_content: supported_content? } end private - attr_reader :repository, :ref, :file_path, :return_url + attr_reader :repository, :ref, :file_path, :return_url, :commit_id delegate :project, to: :repository - def commit - repository.commit(ref) + def supported_content? + master_branch? && extension_supported? && file_exists? + end + + def master_branch? + ref == 'master' + end + + def extension_supported? + File.extname(file_path).in?(SUPPORTED_EXTENSIONS) + end + + def file_exists? + commit_id.present? && repository.blob_at(commit_id, file_path).present? end end end |