terraspace 2.1.2 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/templates/base/project/Gemfile.tt +2 -2
- data/lib/terraspace/cli/new/helpers.rb +2 -1
- data/lib/terraspace/cloud/vcs/commenter.rb +1 -0
- data/lib/terraspace/cloud/vcs/local_git/azure.rb +62 -0
- data/lib/terraspace/cloud/vcs/local_git/base.rb +3 -2
- data/lib/terraspace/cloud/vcs/local_git.rb +15 -5
- data/lib/terraspace/mod.rb +21 -0
- data/lib/terraspace/shell/error.rb +7 -0
- data/lib/terraspace/terraform/runner.rb +12 -0
- data/lib/terraspace/version.rb +1 -1
- data/lib/terraspace.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 786aaa7595dab99d8ffb03635a1bbdac8ac8f05f9bf8d54ac233df032e2656e8
|
4
|
+
data.tar.gz: bdc2ac26c76de54170a7627b9437e4a08535de61a81d868e0b29c8606db80c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f57094e1b29721f0948e1e94ac264cafa2b57dde3c55e4d5c5807cfff5c4ebf5ef044f8ca8a2b1132be13294c03f5a350ccc70db6fc4642226445fc4346c9c1
|
7
|
+
data.tar.gz: 8b700ec6b2543b0388d6be8989cee3bdeb14e814b927c93b6aa6855a00e31cf6117587d8300cf875b44771bd24e4d5a6aa0d260456f453a8ee73625cefa32a91
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [2.1.5] - 2022-07-21
|
7
|
+
- [#255](https://github.com/boltops-tools/terraspace/pull/255) dont compute git info when not cloud not enabled and warn message improvement
|
8
|
+
- pin terraspace to major version in initially generated Gemfile
|
9
|
+
|
10
|
+
## [2.1.4] - 2022-07-16
|
11
|
+
- [#252](https://github.com/boltops-tools/terraspace/pull/252) puts friendlier user message with terraspace force_unlock suggestion
|
12
|
+
- [#253](https://github.com/boltops-tools/terraspace/pull/253) azure repo local git support
|
13
|
+
|
14
|
+
## [2.1.3] - 2022-07-13
|
15
|
+
- [#251](https://github.com/boltops-tools/terraspace/pull/251) deprecation warning for `:CACHE_ROOT` in `config.build.cache_dir`
|
16
|
+
|
6
17
|
## [2.1.2] - 2022-07-13
|
7
18
|
- [#249](https://github.com/boltops-tools/terraspace/pull/249) fix cost.enabled setting when nil
|
8
19
|
|
@@ -10,5 +10,5 @@ build_gemfile(
|
|
10
10
|
|
11
11
|
# Uncomment the ci and vcs provider you wish to use. Should use both ci and vcs gem
|
12
12
|
# Docs: https://terraspace.cloud/docs/ci/
|
13
|
-
# gem "terraspace_ci_github"
|
14
|
-
# gem "terraspace_vcs_github"
|
13
|
+
# gem "terraspace_ci_github" # gathers info from ci env
|
14
|
+
# gem "terraspace_vcs_github" # post comment on pr
|
@@ -13,7 +13,8 @@ class Terraspace::CLI::New
|
|
13
13
|
|
14
14
|
def gem_line(name)
|
15
15
|
if name == "terraspace"
|
16
|
-
|
16
|
+
major_version = Terraspace::VERSION.split('.').first
|
17
|
+
%Q|gem "#{name}", '~> #{major_version}'|
|
17
18
|
else
|
18
19
|
%Q|gem "#{name}"|
|
19
20
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class Terraspace::Cloud::Vcs::LocalGit
|
2
|
+
class Azure < Base
|
3
|
+
def vars
|
4
|
+
super.merge(
|
5
|
+
host: host,
|
6
|
+
full_repo: full_repo,
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
def commit_url
|
11
|
+
# IE: https://dev.azure.com/tongueroo/infra-project/_git/infra-ci/commit/aaa74f96d76053672ff1b91995c903605cd8a245
|
12
|
+
"#{base_repo_url}/commits/#{sha}" if sha
|
13
|
+
end
|
14
|
+
|
15
|
+
def base_repo_url
|
16
|
+
"#{host}/#{org}/#{project}/_git/#{repo}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def branch_url
|
20
|
+
# IE: https://dev.azure.com/tongueroo/infra-project/_git/infra-ci?version=GBmerge
|
21
|
+
"#{base_repo_url}?verison=GB#{sha}" if sha
|
22
|
+
end
|
23
|
+
|
24
|
+
# Also computed in ci plugins which detects it from the ci env.
|
25
|
+
# Also handling here for case when user provides PR_NUMBER and GIT_REPO outside of normal CI env.
|
26
|
+
def pr_url
|
27
|
+
"#{host}/#{full_repo}/pull-requests/#{pr_number}" if pr_number
|
28
|
+
end
|
29
|
+
|
30
|
+
# override to remove ssh
|
31
|
+
# https://ssh.dev.azure.com => https://dev.azure.com
|
32
|
+
def host
|
33
|
+
"https://dev.azure.com"
|
34
|
+
end
|
35
|
+
|
36
|
+
def url_info
|
37
|
+
uri = URI(git_url)
|
38
|
+
# IE: v3/tongueroo/infra-project/infra-ci
|
39
|
+
uri.path.sub(/^\//,'').split('/') # [version, org, project, repo]
|
40
|
+
end
|
41
|
+
|
42
|
+
def org
|
43
|
+
version, org, project, repo = url_info
|
44
|
+
org
|
45
|
+
end
|
46
|
+
|
47
|
+
def repo
|
48
|
+
version, org, project, repo = url_info
|
49
|
+
repo
|
50
|
+
end
|
51
|
+
|
52
|
+
def full_repo
|
53
|
+
version, org, project, repo = url_info
|
54
|
+
"#{org}/#{repo}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def project
|
58
|
+
version, org, project, repo = url_info
|
59
|
+
project
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class Terraspace::Cloud::Vcs
|
2
2
|
class LocalGit < Base
|
3
3
|
def vars
|
4
|
-
if git_repo? && git_installed?
|
5
|
-
provider_vars = vcs_class ? vcs_class.new(base_vars).vars : {}
|
4
|
+
if git_repo? && git_installed? && host
|
5
|
+
provider_vars = vcs_class ? vcs_class.new(base_vars, git_url).vars : {}
|
6
6
|
base_vars.merge(provider_vars).compact # remove items with nil values
|
7
7
|
else
|
8
8
|
{ build_system: "manual" }
|
@@ -11,9 +11,10 @@ class Terraspace::Cloud::Vcs
|
|
11
11
|
|
12
12
|
def vcs_class
|
13
13
|
case host
|
14
|
-
when /github/ then Github
|
15
|
-
when /gitlab/ then Gitlab
|
16
|
-
when /bitbucket/ then Bitbucket
|
14
|
+
when /github\.com/ then Github
|
15
|
+
when /gitlab\.com/ then Gitlab
|
16
|
+
when /bitbucket\.org/ then Bitbucket
|
17
|
+
when /ssh\.dev\.azure\.com/ then Azure
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -35,6 +36,15 @@ class Terraspace::Cloud::Vcs
|
|
35
36
|
return nil if git_url.blank?
|
36
37
|
uri = URI(git_url)
|
37
38
|
"#{uri.scheme}://#{uri.host}"
|
39
|
+
rescue URI::InvalidURIError => e
|
40
|
+
logger.info "WARN: #{e.class} #{e.message}".color(:yellow)
|
41
|
+
logger.info <<~EOL
|
42
|
+
Unable to get the host info from your local .git/config
|
43
|
+
Will not be able to determine local git info.
|
44
|
+
If possible, it would be a useful to provide the remote.url in your .git/config
|
45
|
+
as an issue report or email to improve help improve this logic.
|
46
|
+
EOL
|
47
|
+
nil
|
38
48
|
end
|
39
49
|
|
40
50
|
def full_repo
|
data/lib/terraspace/mod.rb
CHANGED
@@ -128,6 +128,27 @@ module Terraspace
|
|
128
128
|
raise "ERROR: config.build.cache_dir is not a String or responds to the .call method."
|
129
129
|
end
|
130
130
|
|
131
|
+
if pattern.include?(":CACHE_ROOT")
|
132
|
+
old_pattern = pattern
|
133
|
+
pattern = pattern.sub(':CACHE_ROOT/', '')
|
134
|
+
logger.info "WARN: Detected :CACHE_ROOT in config.build.cache_dir".color(:yellow)
|
135
|
+
logger.info <<~EOL
|
136
|
+
This has been deprecated and :CACHE_ROOT should not be in the config.build.cache_dir setting.
|
137
|
+
The :CACHE_ROOT pattern has been removed from config.build.cache_dir automatically.
|
138
|
+
|
139
|
+
To remove this warning, remove the :CACHE_ROOT. For example:
|
140
|
+
|
141
|
+
config/app.rb
|
142
|
+
|
143
|
+
config.build.cache_dir = "#{old_pattern}"
|
144
|
+
|
145
|
+
Update it to:
|
146
|
+
|
147
|
+
config.build.cache_dir = "#{pattern}"
|
148
|
+
|
149
|
+
EOL
|
150
|
+
end
|
151
|
+
|
131
152
|
path = expansion(pattern)
|
132
153
|
path = "#{Terraspace.cache_root}/#{path}"
|
133
154
|
path.gsub!(%r{/+},'/') # remove double slashes are more. IE: // -> / Useful since region is '' in generic expander
|
@@ -16,6 +16,8 @@ class Terraspace::Shell
|
|
16
16
|
Terraspace::BucketNotFoundError.new(message)
|
17
17
|
elsif shared_cache_error?
|
18
18
|
Terraspace::SharedCacheError.new(message)
|
19
|
+
elsif state_lock_error?
|
20
|
+
Terraspace::StateLockError.new(message)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
@@ -43,5 +45,10 @@ class Terraspace::Shell
|
|
43
45
|
message.include?("Failed to install provider from shared cache") ||
|
44
46
|
message.include?("Failed to validate installed provider")
|
45
47
|
end
|
48
|
+
|
49
|
+
def state_lock_error?
|
50
|
+
# Example: https://gist.github.com/tongueroo/6bcb86f88053c58fa50f434789268b78
|
51
|
+
message.include?("Error acquiring the state lock")
|
52
|
+
end
|
46
53
|
end
|
47
54
|
end
|
@@ -65,6 +65,18 @@ module Terraspace::Terraform
|
|
65
65
|
else
|
66
66
|
exit(1)
|
67
67
|
end
|
68
|
+
rescue Terraspace::StateLockError => e
|
69
|
+
logger.debug "ERROR: #{e.class}".color(:red)
|
70
|
+
logger.info e.message
|
71
|
+
md = e.message.match(/\s+ID:\s+(.*)/)
|
72
|
+
return unless md
|
73
|
+
return unless lock_id = md[1]
|
74
|
+
logger.info <<~EOL
|
75
|
+
You can force release the lock with:
|
76
|
+
|
77
|
+
terraspace force_unlock #{@mod.name} #{lock_id}
|
78
|
+
|
79
|
+
EOL
|
68
80
|
end
|
69
81
|
|
70
82
|
@@current_dir_message_shown = false
|
data/lib/terraspace/version.rb
CHANGED
data/lib/terraspace.rb
CHANGED
@@ -32,9 +32,10 @@ module Terraspace
|
|
32
32
|
|
33
33
|
class BucketNotFoundError < Error; end
|
34
34
|
class InitRequiredError < Error; end
|
35
|
+
class NetworkError < Error; end
|
35
36
|
class SharedCacheError < Error; end
|
36
37
|
class ShellError < Error; end
|
37
|
-
class
|
38
|
+
class StateLockError < Error; end
|
38
39
|
end
|
39
40
|
|
40
41
|
Terraspace::Booter.boot
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -670,6 +670,7 @@ files:
|
|
670
670
|
- lib/terraspace/cloud/vcs/interface.rb
|
671
671
|
- lib/terraspace/cloud/vcs/local_env.rb
|
672
672
|
- lib/terraspace/cloud/vcs/local_git.rb
|
673
|
+
- lib/terraspace/cloud/vcs/local_git/azure.rb
|
673
674
|
- lib/terraspace/cloud/vcs/local_git/base.rb
|
674
675
|
- lib/terraspace/cloud/vcs/local_git/bitbucket.rb
|
675
676
|
- lib/terraspace/cloud/vcs/local_git/github.rb
|