devfile 0.0.15.pre.alpha1-x86_64-linux → 0.0.17.pre.alpha1-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dd5cde59eace92d015353ca37457ce78ca42b11a78deedb76f8b6374b81bc6e
4
- data.tar.gz: 426dacd724bca8169688bcaf37b8f8714817e0638fb4c2666e2e34e70dbb2bc7
3
+ metadata.gz: ea3839d4f076670d08337bb481249b5f07c4ffb97cf4051f1dca13af5aefcf1e
4
+ data.tar.gz: 396fee69f962ed4e0ebbabf088d02f054443a33882877052a7766330893afde8
5
5
  SHA512:
6
- metadata.gz: cc55a8d805d9ac1aa0253b1343e90cf96b6a2bb78ceb6e9713710167b0f054b9994bbd212c4ef02ead8a614eed1a7874c2c6ebfc1cec2a4f134db3a7115318de
7
- data.tar.gz: 7f9c71f44ce42160bcc29efeff03efe4fdface8aa59eec4755aebcfbd8aed01740d0558aa42d8d86eaf49b3163a41d60731458ab23122cad72cf61cd9cd4c43f
6
+ metadata.gz: eff63c30e600f2891adbca1842fa1c1541f8c44e21cb9c2c5feb3c418a4d04f3da38248c54cf585659ed4853916a04b5e7b19a92b263700ff4152d8c063c0578
7
+ data.tar.gz: a6f76347aab7b8f8fd4dcf5da912c9a501d597394845f20f972291889dad25db4a962162568ee9c759313de987eb873c8aa595b91a7f084f8122c7f1b70a5251
data/bin/devfile CHANGED
Binary file
data/ext/devfile.go CHANGED
@@ -7,6 +7,7 @@ import (
7
7
  "strconv"
8
8
  "text/template"
9
9
 
10
+ "github.com/devfile/library/v2/pkg/devfile"
10
11
  "github.com/devfile/library/v2/pkg/devfile/generator"
11
12
  "github.com/devfile/library/v2/pkg/devfile/parser"
12
13
  "github.com/devfile/library/v2/pkg/devfile/parser/data/v2/common"
@@ -292,15 +293,21 @@ func (d Devfile) hasContainerComponents() (bool, error) {
292
293
  return false, nil
293
294
  }
294
295
 
295
- func (d Devfile) getFlattenedDevfileContent() string {
296
- return string(d.devfileObj.Ctx.GetDevfileContent())
296
+ func (d Devfile) getFlattenedDevfileContent() (string, error) {
297
+ b, err := yaml.Marshal(d.devfileObj.Data)
298
+ if err != nil {
299
+ return "", err
300
+ }
301
+ return string(b), nil
297
302
  }
298
303
 
299
304
  func parseDevfile(content string) (Devfile, error) {
300
305
  parserArgs := parser.ParserArgs{
301
306
  Data: []byte(content),
302
307
  }
303
- devfileObj, err := parser.ParseDevfile(parserArgs)
308
+ // TODO: figure out how to handle warnings
309
+ // https://gitlab.com/gitlab-org/remote-development/devfile-gem/-/issues/6
310
+ devfileObj, _, err := devfile.ParseDevfileAndValidate(parserArgs)
304
311
  return Devfile{
305
312
  devfileObj: devfileObj,
306
313
  }, err
data/ext/go.mod CHANGED
@@ -1,8 +1,9 @@
1
1
  module gitlab-org/remote-development/devfile-gem
2
2
 
3
- go 1.18
3
+ go 1.19
4
4
 
5
5
  require (
6
+ github.com/devfile/api/v2 v2.2.0
6
7
  github.com/devfile/library/v2 v2.2.0
7
8
  k8s.io/api v0.26.1
8
9
  k8s.io/apimachinery v0.26.1
@@ -19,7 +20,6 @@ require (
19
20
  github.com/cespare/xxhash/v2 v2.1.2 // indirect
20
21
  github.com/containerd/containerd v1.5.9 // indirect
21
22
  github.com/davecgh/go-spew v1.1.1 // indirect
22
- github.com/devfile/api/v2 v2.2.0 // indirect
23
23
  github.com/devfile/registry-support/index/generator v0.0.0-20221018203505-df96d34d4273 // indirect
24
24
  github.com/devfile/registry-support/registry-library v0.0.0-20221018213054-47b3ffaeadba // indirect
25
25
  github.com/docker/cli v20.10.11+incompatible // indirect
data/ext/main.go CHANGED
@@ -232,7 +232,10 @@ func flatten(devfile string) (string, error) {
232
232
  if err != nil {
233
233
  return "", err
234
234
  }
235
- flattenedDevfile := d.getFlattenedDevfileContent()
235
+ flattenedDevfile, err := d.getFlattenedDevfileContent()
236
+ if err != nil {
237
+ return "", err
238
+ }
236
239
  content, err := marshalDevfile(flattenedDevfile)
237
240
  if err != nil {
238
241
  return "", err
data/lib/devfile.rb CHANGED
@@ -10,57 +10,33 @@ module Devfile
10
10
 
11
11
  class << self
12
12
  def get_deployment(devfile, name, namespace, labels, annotations, replicas)
13
- stdout, stderr, status = Open3.capture3(
14
- "#{FILE_PATH} deployment '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}' #{replicas}"
15
- )
16
-
17
- raise stderr unless status.success?
18
-
19
- stdout
13
+ call('deployment', devfile, name, namespace, labels, annotations, replicas)
20
14
  end
21
15
 
22
16
  def get_service(devfile, name, namespace, labels, annotations)
23
- stdout, stderr, status = Open3.capture3(
24
- "#{FILE_PATH} service '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}'"
25
- )
26
-
27
- raise stderr unless status.success?
28
-
29
- stdout
17
+ call('service', devfile, name, namespace, labels, annotations)
30
18
  end
31
19
 
32
20
  def get_ingress(devfile, name, namespace, labels, annotations, domain_template, ingress_class)
33
- stdout, stderr, status = Open3.capture3(
34
- "#{FILE_PATH} ingress '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}' #{domain_template} #{ingress_class}"
35
- )
36
-
37
- raise stderr unless status.success?
38
-
39
- stdout
21
+ call('ingress', devfile, name, namespace, labels, annotations, domain_template, ingress_class)
40
22
  end
41
23
 
42
24
  def get_pvc(devfile, name, namespace, labels, annotations)
43
- stdout, stderr, status = Open3.capture3(
44
- "#{FILE_PATH} deployment '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}'"
45
- )
46
-
47
- raise stderr unless status.success?
48
-
49
- stdout
25
+ call('deployment', devfile, name, namespace, labels, annotations)
50
26
  end
51
27
 
52
28
  def get_all(devfile, name, namespace, labels, annotations, replicas, domain_template, ingress_class)
53
- stdout, stderr, status = Open3.capture3(
54
- "#{FILE_PATH} all '#{devfile}' #{name} #{namespace} '#{labels}' '#{annotations}' #{replicas} #{domain_template} #{ingress_class}"
55
- )
56
-
57
- raise stderr unless status.success?
58
-
59
- stdout
29
+ call('all', devfile, name, namespace, labels, annotations, replicas, domain_template, ingress_class)
60
30
  end
61
31
 
62
32
  def flatten(devfile)
63
- stdout, stderr, status = Open3.capture3("#{FILE_PATH} flatten '#{devfile}'")
33
+ call('flatten', devfile)
34
+ end
35
+
36
+ private
37
+
38
+ def call(*cmd)
39
+ stdout, stderr, status = Open3.capture3({}, FILE_PATH, *cmd.map(&:to_s))
64
40
 
65
41
  raise stderr unless status.success?
66
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15.pre.alpha1
4
+ version: 0.0.17.pre.alpha1
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-27 00:00:00.000000000 Z
11
+ date: 2023-05-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Library used to generate kubernetes manifests from a Devfile.
14
14
  email: