Commit d9fb27f4 authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Lin Jen-Shin

Make serverless template a valid abstract template

parent b1ef8391
...@@ -39,10 +39,3 @@ stages: ...@@ -39,10 +39,3 @@ stages:
- tm -n "$KUBE_NAMESPACE" set registry-auth gitlab-registry --registry "$CI_REGISTRY" --username "$CI_REGISTRY_USER" --password "$CI_JOB_TOKEN" --push - tm -n "$KUBE_NAMESPACE" set registry-auth gitlab-registry --registry "$CI_REGISTRY" --username "$CI_REGISTRY_USER" --password "$CI_JOB_TOKEN" --push
- tm -n "$KUBE_NAMESPACE" set registry-auth gitlab-registry --registry "$CI_REGISTRY" --username "$CI_DEPLOY_USER" --password "$CI_DEPLOY_PASSWORD" --pull - tm -n "$KUBE_NAMESPACE" set registry-auth gitlab-registry --registry "$CI_REGISTRY" --username "$CI_DEPLOY_USER" --password "$CI_DEPLOY_PASSWORD" --pull
- tm -n "$KUBE_NAMESPACE" deploy --wait - tm -n "$KUBE_NAMESPACE" deploy --wait
deploy-functions:
extends: .serverless:deploy:functions
environment: production
only:
variables:
- $CI_COMMIT_MESSAGE =~ /\[serverless deploy-functions\]/
...@@ -3,9 +3,40 @@ ...@@ -3,9 +3,40 @@
require 'spec_helper' require 'spec_helper'
describe "CI YML Templates" do describe "CI YML Templates" do
Gitlab::Template::GitlabCiYmlTemplate.all.each do |template| ABSTRACT_TEMPLATES = %w[Serverless]
it "#{template.name} should be valid" do
expect { Gitlab::Ci::YamlProcessor.new(template.content) }.not_to raise_error def self.concrete_templates
Gitlab::Template::GitlabCiYmlTemplate.all.reject do |template|
ABSTRACT_TEMPLATES.include?(template.name)
end
end
def self.abstract_templates
Gitlab::Template::GitlabCiYmlTemplate.all.select do |template|
ABSTRACT_TEMPLATES.include?(template.name)
end
end
describe 'concrete templates with CI/CD jobs' do
concrete_templates.each do |template|
it "#{template.name} template should be valid" do
expect { Gitlab::Ci::YamlProcessor.new(template.content) }
.not_to raise_error
end
end
end
describe 'abstract templates without concrete jobs defined' do
abstract_templates.each do |template|
it "#{template.name} template should be valid after being implemented" do
content = template.content + <<~EOS
concrete_build_implemented_by_a_user:
stage: build
script: do something
EOS
expect { Gitlab::Ci::YamlProcessor.new(content) }.not_to raise_error
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment