Commit 8f60a8ba authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-tags-for-envs' into 'master'

Fix tags for environments

Closes gitlab-ee#8397

See merge request gitlab-org/gitlab-ce!22993
parents 33cd8efb 08ef7b9f
......@@ -13,17 +13,14 @@ module Deployable
name: expanded_environment_name
)
environment.deployments.create!(
create_deployment!(
project_id: environment.project_id,
environment: environment,
ref: ref,
tag: tag,
sha: sha,
user: user,
deployable: self,
on_stop: on_stop).tap do |_|
self.reload # Reload relationships
end
on_stop: on_stop)
end
end
end
---
title: Do not reload self on hooks when creating deployment
merge_request:
author:
type: fixed
......@@ -387,15 +387,24 @@ describe Ci::CreatePipelineService do
context 'with environment' do
before do
config = YAML.dump(deploy: { environment: { name: "review/$CI_COMMIT_REF_NAME" }, script: 'ls' })
config = YAML.dump(
deploy: {
environment: { name: "review/$CI_COMMIT_REF_NAME" },
script: 'ls',
tags: ['hello']
})
stub_ci_pipeline_yaml_file(config)
end
it 'creates the environment' do
it 'creates the environment with tags' do
result = execute_service
expect(result).to be_persisted
expect(Environment.find_by(name: "review/master")).to be_present
expect(result.builds.first.tag_list).to contain_exactly('hello')
expect(result.builds.first.deployment).to be_persisted
expect(result.builds.first.deployment.deployable).to be_a(Ci::Build)
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