devfile 0.3.0-arm64-darwin → 0.4.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/devfile +0 -0
- data/lib/devfile.rb +29 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4e6d3a7912442e912fe03e015525190a73c8be4f473711902d38aa58ac92110
|
4
|
+
data.tar.gz: bbe9394bd04ef817786c7d4f8d2c432774032e9190eb37fb02f6e5fe1e0e06dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df279bc6e82f90627003989409ce15632fd95145d2050e94e216ef5ef89ddd99bbfc00d5226b64cec50c8db8a7a16ee8ec50ee7f284d3828aac379446319b14a
|
7
|
+
data.tar.gz: 2c8ff5925c25b280effec1509d9534eeb9a7a5ff59374f4db1bd5128add3228f21e8ca6e39c1a40086495a156259d16ffda1c27fce465f7eeb6daacdb8b4c3b8
|
data/bin/devfile
CHANGED
Binary file
|
data/lib/devfile.rb
CHANGED
@@ -5,12 +5,25 @@ require 'open3'
|
|
5
5
|
# Module that works with the Devfile standard
|
6
6
|
module Devfile
|
7
7
|
class CliError < StandardError; end
|
8
|
+
class UnsupportedPlatform < StandardError; end
|
8
9
|
|
9
10
|
# Set of services to parse a devfile and output k8s manifests
|
10
11
|
class Parser
|
11
12
|
FILE_PATH = File.expand_path('./../bin/devfile', File.dirname(__FILE__))
|
12
13
|
DEVFILE_GEMSPEC = Gem.loaded_specs['devfile']
|
13
|
-
|
14
|
+
RUBY_CPU_TO_GOARCH = {
|
15
|
+
'x86_64' => 'amd64',
|
16
|
+
'aarch64' => 'arm64',
|
17
|
+
'amd64' => 'amd64',
|
18
|
+
'arm64' => 'arm64',
|
19
|
+
'universal' => 'arm64'
|
20
|
+
# This exist because if Rosetta is enabled on mac, it means both arm and amd64 bianries
|
21
|
+
# can be run so the gem lib sets the CPU as "universal".
|
22
|
+
# see: https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment
|
23
|
+
}.freeze
|
24
|
+
ARCH = RUBY_CPU_TO_GOARCH[Gem::Platform.local.cpu] || Gem::Platform.local.cpu
|
25
|
+
SYSTEM_PLATFORM = "#{ARCH}-#{Gem::Platform.local.os}"
|
26
|
+
PLATFORM_SPECIFIC_BINARY_PATH = File.expand_path("./../bin/devfile-#{SYSTEM_PLATFORM}", File.dirname(__FILE__))
|
14
27
|
|
15
28
|
class << self
|
16
29
|
def get_deployment(devfile, name, namespace, labels, annotations, replicas)
|
@@ -40,19 +53,28 @@ module Devfile
|
|
40
53
|
private
|
41
54
|
|
42
55
|
def call(*cmd)
|
43
|
-
|
44
|
-
|
45
|
-
|
56
|
+
file_path = FILE_PATH
|
57
|
+
if ruby_platform?
|
58
|
+
raise_if_unsupported_system_platform!
|
59
|
+
file_path = PLATFORM_SPECIFIC_BINARY_PATH
|
60
|
+
end
|
46
61
|
|
62
|
+
stdout, stderr, status = Open3.capture3({}, file_path, *cmd.map(&:to_s))
|
47
63
|
raise(CliError, stderr) unless status.success?
|
48
64
|
|
49
65
|
stdout
|
50
66
|
end
|
51
67
|
|
52
|
-
def
|
53
|
-
|
68
|
+
def ruby_platform?
|
69
|
+
DEVFILE_GEMSPEC && DEVFILE_GEMSPEC.platform == 'ruby'
|
70
|
+
end
|
71
|
+
|
72
|
+
def raise_if_unsupported_system_platform!
|
73
|
+
return if %w[amd64-linux amd64-darwin arm64-linux arm64-darwin].include?(SYSTEM_PLATFORM)
|
54
74
|
|
55
|
-
|
75
|
+
err_msg = "Unsupported platform:#{SYSTEM_PLATFORM}, devfile-gem only supports " \
|
76
|
+
"os: darwin/linux and architectures: amd64/arm64 for 'ruby' platform only"
|
77
|
+
raise UnsupportedPlatform, err_msg
|
56
78
|
end
|
57
79
|
end
|
58
80
|
end
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- GitLab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Library used to generate kubernetes manifests from a Devfile.
|
14
14
|
email:
|