diffend-monitor 0.2.40 → 0.2.46
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +26 -1
- data/certs/mensfeld.pem +21 -21
- data/diffend.gemspec +14 -4
- data/lib/diffend/commands.rb +2 -0
- data/lib/diffend/configs/error_messages.rb +11 -0
- data/lib/diffend/configs/validator.rb +22 -0
- data/lib/diffend/errors.rb +2 -0
- data/lib/diffend/execute.rb +4 -3
- data/lib/diffend/handle_errors/report.rb +4 -4
- data/lib/diffend/integration_repository.rb +92 -0
- data/lib/diffend/local_context/host.rb +12 -1
- data/lib/diffend/local_context/packages.rb +10 -27
- data/lib/diffend/plugin.rb +3 -0
- data/lib/diffend/repository.rb +109 -0
- data/lib/diffend/request_object.rb +1 -1
- data/lib/diffend/request_verdict.rb +4 -4
- data/lib/diffend/shell.rb +44 -0
- data/lib/diffend/track.rb +4 -4
- data/lib/diffend/version.rb +1 -1
- metadata +35 -47
- metadata.gz.sig +0 -0
- data/.coditsu/ci.yml +0 -3
- data/.diffend.yml +0 -3
- data/.github/workflows/ci.yml +0 -88
- data/.gitignore +0 -58
- data/.rspec +0 -1
- data/.ruby-version +0 -1
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -40
- data/bin/bundle +0 -114
- data/bin/byebug +0 -29
- data/bin/htmldiff +0 -29
- data/bin/ldiff +0 -29
- data/bin/rake +0 -29
- data/bin/rspec +0 -29
- data/certs/tomaszpajor.pem +0 -25
- data/scripts/generate_payload_for_file.rb +0 -14
data/lib/diffend/plugin.rb
CHANGED
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
%w[
|
4
|
+
tmpdir
|
5
|
+
securerandom
|
6
|
+
].each(&method(:require))
|
7
|
+
|
8
|
+
module Diffend
|
9
|
+
# Repository for specs
|
10
|
+
class Repository
|
11
|
+
# Repositories path
|
12
|
+
REPOSITORIES_PATH = File.join(
|
13
|
+
File.expand_path('..', Bundler.bin_path),
|
14
|
+
'repositories'
|
15
|
+
).freeze
|
16
|
+
# List of supported repositories split by command
|
17
|
+
SUPPORTED = {
|
18
|
+
'install' => %w[
|
19
|
+
with_gemfile_lock
|
20
|
+
with_gemfile_lock_with_added_gem
|
21
|
+
with_gemfile_lock_with_changed_gem_version
|
22
|
+
with_gemfile_lock_with_locked_gem_version
|
23
|
+
with_gemfile_lock_with_removed_gem
|
24
|
+
with_gemfile_lock_with_two_platforms
|
25
|
+
with_gemfile_lock_with_two_primary_sources
|
26
|
+
with_gemfile_lock_with_two_sources
|
27
|
+
without_gemfile_lock
|
28
|
+
].freeze,
|
29
|
+
'update' => %w[
|
30
|
+
with_gemfile_lock
|
31
|
+
with_gemfile_lock_with_added_gem
|
32
|
+
with_gemfile_lock_with_removed_gem
|
33
|
+
with_gemfile_lock_with_two_primary_sources
|
34
|
+
with_gemfile_lock_with_two_sources
|
35
|
+
without_gemfile_lock
|
36
|
+
].freeze
|
37
|
+
}.freeze
|
38
|
+
|
39
|
+
attr_reader :name, :path
|
40
|
+
|
41
|
+
# @param command [String] command executed via bundler
|
42
|
+
# @param name [String] repository name
|
43
|
+
def initialize(command, name)
|
44
|
+
@command = command
|
45
|
+
@name = name
|
46
|
+
@path = File.join(Dir.tmpdir, SecureRandom.uuid)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Build repository path
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
def orig_path
|
53
|
+
@orig_path ||= global_file_path(
|
54
|
+
File.join(
|
55
|
+
bundler_version_string,
|
56
|
+
"#{@command}_#{name}"
|
57
|
+
)
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Setup an isolated instance of a repository
|
62
|
+
def setup
|
63
|
+
FileUtils.cp_r(orig_path, path)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Clean isolated instance of a repository
|
67
|
+
def clean
|
68
|
+
FileUtils.rm_rf(path)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Execute tasks in an isolated instance of a repository
|
72
|
+
def isolate
|
73
|
+
setup
|
74
|
+
yield(path)
|
75
|
+
clean
|
76
|
+
end
|
77
|
+
|
78
|
+
# Build the path to a specified file within the repository
|
79
|
+
#
|
80
|
+
# @param file_name [String]
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
def file_path(file_name)
|
84
|
+
File.join(
|
85
|
+
path,
|
86
|
+
file_name
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Build global path
|
91
|
+
#
|
92
|
+
# @param file_name [String]
|
93
|
+
#
|
94
|
+
# @return [String]
|
95
|
+
def global_file_path(file_name)
|
96
|
+
File.join(
|
97
|
+
REPOSITORIES_PATH,
|
98
|
+
file_name
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Build bundler version string
|
103
|
+
#
|
104
|
+
# @return [String]
|
105
|
+
def bundler_version_string
|
106
|
+
@bundler_version_string ||= "bundler_#{Bundler::VERSION.tr('.', '_')}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -42,10 +42,10 @@ module Diffend
|
|
42
42
|
# @return [Diffend::RequestObject]
|
43
43
|
def build_request_object(config, payload)
|
44
44
|
Diffend::RequestObject.new(
|
45
|
-
config
|
46
|
-
|
47
|
-
payload
|
48
|
-
|
45
|
+
config,
|
46
|
+
config.commands_url,
|
47
|
+
payload,
|
48
|
+
:post
|
49
49
|
)
|
50
50
|
end
|
51
51
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
# Helper commands for running Linux shell commands
|
6
|
+
module Diffend
|
7
|
+
module Shell
|
8
|
+
class << self
|
9
|
+
# Allows to execute shell commands and handle errors, etc later
|
10
|
+
# (won't raise any errors but instead will catch all things)
|
11
|
+
# @param command_with_options [String] command that should be executed with
|
12
|
+
# all the arguments and options
|
13
|
+
# @param raise_on_invalid_exit [Boolean] raise exception when exit code is not 0
|
14
|
+
# @return [Hash] hash with 3 keys describing output
|
15
|
+
# (stdout, stderr, exit_code)
|
16
|
+
# @example Run ls
|
17
|
+
# SupportEngine::Shell.('ls') =>
|
18
|
+
# { stdout: "test.rb\n", stderr: '', exit_code: 0}
|
19
|
+
def call(command_with_options, raise_on_invalid_exit: true)
|
20
|
+
stdout_str, stderr_str, status = Open3.capture3(command_with_options)
|
21
|
+
|
22
|
+
result = {
|
23
|
+
stdout: stdout_str,
|
24
|
+
stderr: stderr_str,
|
25
|
+
exit_code: status.exitstatus
|
26
|
+
}
|
27
|
+
|
28
|
+
raise Diffend::Errors::FailedShellCommand, result.values.join(': ') \
|
29
|
+
if raise_on_invalid_exit && result[:exit_code] != 0
|
30
|
+
|
31
|
+
result
|
32
|
+
end
|
33
|
+
|
34
|
+
# @param path [String, Pathname] to a place where git repo is
|
35
|
+
# @param command [String] that we want to execute in path context
|
36
|
+
# @param raise_on_invalid_exit [Boolean] raise exception when exit code is not 0
|
37
|
+
# @return [Hash] hash with 3 keys describing output (stdout, stderr, exit_code)
|
38
|
+
def call_in_path(path, command, raise_on_invalid_exit: true)
|
39
|
+
command = ['cd', path.to_s, '&&', command]
|
40
|
+
call(command.join(' '), raise_on_invalid_exit: raise_on_invalid_exit)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/diffend/track.rb
CHANGED
@@ -62,10 +62,10 @@ module Diffend
|
|
62
62
|
# @return [Diffend::RequestObject]
|
63
63
|
def build_request_object(request_id)
|
64
64
|
Diffend::RequestObject.new(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
@config,
|
66
|
+
@config.track_url(request_id),
|
67
|
+
{ id: request_id }.freeze,
|
68
|
+
:put
|
69
69
|
).freeze
|
70
70
|
end
|
71
71
|
end
|
data/lib/diffend/version.rb
CHANGED
metadata
CHANGED
@@ -1,40 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffend-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Pajor
|
8
|
-
|
8
|
+
- Maciej Mensfeld
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain:
|
11
12
|
- |
|
12
13
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
14
|
+
MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
|
15
|
+
ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMjAwODExMDkxNTM3WhcNMjEwODExMDkx
|
16
|
+
NTM3WjAjMSEwHwYDVQQDDBhtYWNpZWovREM9bWVuc2ZlbGQvREM9cGwwggGiMA0G
|
17
|
+
CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDCpXsCgmINb6lHBXXBdyrgsBPSxC4/
|
18
|
+
2H+weJ6L9CruTiv2+2/ZkQGtnLcDgrD14rdLIHK7t0o3EKYlDT5GhD/XUVhI15JE
|
19
|
+
N7IqnPUgexe1fbZArwQ51afxz2AmPQN2BkB2oeQHXxnSWUGMhvcEZpfbxCCJH26w
|
20
|
+
hS0Ccsma8yxA6hSlGVhFVDuCr7c2L1di6cK2CtIDpfDaWqnVNJEwBYHIxrCoWK5g
|
21
|
+
sIGekVt/admS9gRhIMaIBg+Mshth5/DEyWO2QjteTodItlxfTctrfmiAl8X8T5JP
|
22
|
+
VXeLp5SS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----
|
37
|
-
date: 2021-
|
38
|
+
date: 2021-05-05 00:00:00.000000000 Z
|
38
39
|
dependencies:
|
39
40
|
- !ruby/object:Gem::Dependency
|
40
41
|
name: bundler
|
@@ -64,32 +65,17 @@ dependencies:
|
|
64
65
|
- - ">="
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: '0'
|
67
|
-
description:
|
68
|
+
description:
|
68
69
|
email:
|
69
70
|
- contact@diffend.io
|
70
71
|
executables: []
|
71
72
|
extensions: []
|
72
73
|
extra_rdoc_files: []
|
73
74
|
files:
|
74
|
-
- ".coditsu/ci.yml"
|
75
|
-
- ".diffend.yml"
|
76
|
-
- ".github/workflows/ci.yml"
|
77
|
-
- ".gitignore"
|
78
|
-
- ".rspec"
|
79
|
-
- ".ruby-version"
|
80
75
|
- CHANGELOG.md
|
81
|
-
- Gemfile
|
82
|
-
- Gemfile.lock
|
83
76
|
- LICENSE.md
|
84
77
|
- README.md
|
85
|
-
- bin/bundle
|
86
|
-
- bin/byebug
|
87
|
-
- bin/htmldiff
|
88
|
-
- bin/ldiff
|
89
|
-
- bin/rake
|
90
|
-
- bin/rspec
|
91
78
|
- certs/mensfeld.pem
|
92
|
-
- certs/tomaszpajor.pem
|
93
79
|
- config/diffend.yml
|
94
80
|
- diffend.gemspec
|
95
81
|
- lib/diffend.rb
|
@@ -107,6 +93,7 @@ files:
|
|
107
93
|
- lib/diffend/handle_errors/display_to_stdout.rb
|
108
94
|
- lib/diffend/handle_errors/messages.rb
|
109
95
|
- lib/diffend/handle_errors/report.rb
|
96
|
+
- lib/diffend/integration_repository.rb
|
110
97
|
- lib/diffend/latest_version.rb
|
111
98
|
- lib/diffend/local_context.rb
|
112
99
|
- lib/diffend/local_context/diffend.rb
|
@@ -116,18 +103,19 @@ files:
|
|
116
103
|
- lib/diffend/logger.rb
|
117
104
|
- lib/diffend/monitor.rb
|
118
105
|
- lib/diffend/plugin.rb
|
106
|
+
- lib/diffend/repository.rb
|
119
107
|
- lib/diffend/request.rb
|
120
108
|
- lib/diffend/request_object.rb
|
121
109
|
- lib/diffend/request_verdict.rb
|
110
|
+
- lib/diffend/shell.rb
|
122
111
|
- lib/diffend/track.rb
|
123
112
|
- lib/diffend/version.rb
|
124
113
|
- plugins.rb
|
125
|
-
- scripts/generate_payload_for_file.rb
|
126
114
|
homepage: https://diffend.io
|
127
115
|
licenses:
|
128
116
|
- Prosperity Public License
|
129
117
|
metadata: {}
|
130
|
-
post_install_message:
|
118
|
+
post_install_message:
|
131
119
|
rdoc_options: []
|
132
120
|
require_paths:
|
133
121
|
- lib
|
@@ -135,15 +123,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
123
|
requirements:
|
136
124
|
- - ">="
|
137
125
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
126
|
+
version: '0'
|
139
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
128
|
requirements:
|
141
129
|
- - ">="
|
142
130
|
- !ruby/object:Gem::Version
|
143
131
|
version: '0'
|
144
132
|
requirements: []
|
145
|
-
rubygems_version: 3.2.
|
146
|
-
signing_key:
|
133
|
+
rubygems_version: 3.2.15
|
134
|
+
signing_key:
|
147
135
|
specification_version: 4
|
148
136
|
summary: OSS supply chain security and management platform
|
149
137
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/.coditsu/ci.yml
DELETED
data/.diffend.yml
DELETED
data/.github/workflows/ci.yml
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
name: ci
|
2
|
-
|
3
|
-
jobs:
|
4
|
-
specs:
|
5
|
-
needs:
|
6
|
-
- diffend
|
7
|
-
- coditsu
|
8
|
-
|
9
|
-
runs-on: ubuntu-latest
|
10
|
-
strategy:
|
11
|
-
fail-fast: false
|
12
|
-
matrix:
|
13
|
-
ruby:
|
14
|
-
- '3.0'
|
15
|
-
- '2.7'
|
16
|
-
- '2.6'
|
17
|
-
- '2.5'
|
18
|
-
- 'jruby-9.2.14.0'
|
19
|
-
bundler:
|
20
|
-
- '2.1.4'
|
21
|
-
- '2.2.7'
|
22
|
-
include:
|
23
|
-
- ruby: '2.7'
|
24
|
-
coverage: 'true'
|
25
|
-
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@v2
|
28
|
-
- uses: actions/cache@v2
|
29
|
-
with:
|
30
|
-
path: vendor/bundle
|
31
|
-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
32
|
-
restore-keys: |
|
33
|
-
${{ runner.os }}-gems-
|
34
|
-
- name: Install package dependencies
|
35
|
-
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
|
36
|
-
- name: Set up Ruby
|
37
|
-
uses: ruby/setup-ruby@v1
|
38
|
-
with:
|
39
|
-
ruby-version: ${{matrix.ruby}}
|
40
|
-
bundler: ${{matrix.bundler}}
|
41
|
-
- name: Bundle install
|
42
|
-
env:
|
43
|
-
DIFFEND_DEVELOPMENT: true
|
44
|
-
run: |
|
45
|
-
bundle _${{matrix.bundler}}_ config path vendor/bundle
|
46
|
-
bundle _${{matrix.bundler}}_ install --jobs 4 --retry 3
|
47
|
-
- name: Run all tests
|
48
|
-
env:
|
49
|
-
GITHUB_COVERAGE: ${{matrix.coverage}}
|
50
|
-
run: bundle _${{matrix.bundler}}_ exec rspec
|
51
|
-
|
52
|
-
diffend:
|
53
|
-
runs-on: ubuntu-latest
|
54
|
-
strategy:
|
55
|
-
fail-fast: false
|
56
|
-
steps:
|
57
|
-
- uses: actions/checkout@v2
|
58
|
-
with:
|
59
|
-
fetch-depth: 0
|
60
|
-
- name: Set up Ruby
|
61
|
-
uses: ruby/setup-ruby@v1
|
62
|
-
with:
|
63
|
-
ruby-version: 3.0
|
64
|
-
- name: Install latest bundler
|
65
|
-
run: gem install bundler --no-document
|
66
|
-
- name: Install Diffend plugin
|
67
|
-
run: bundle plugin install diffend
|
68
|
-
- name: Bundle Secure
|
69
|
-
run: bundle secure
|
70
|
-
|
71
|
-
coditsu:
|
72
|
-
runs-on: ubuntu-latest
|
73
|
-
strategy:
|
74
|
-
fail-fast: false
|
75
|
-
steps:
|
76
|
-
- uses: actions/checkout@v2
|
77
|
-
with:
|
78
|
-
fetch-depth: 0
|
79
|
-
- name: Run Coditsu
|
80
|
-
env:
|
81
|
-
CODITSU_API_KEY: ${{ secrets.CODITSU_API_KEY }}
|
82
|
-
CODITSU_API_SECRET: ${{ secrets.CODITSU_API_SECRET }}
|
83
|
-
run: \curl -sSL https://api.coditsu.io/run/ci | bash
|
84
|
-
|
85
|
-
on:
|
86
|
-
push:
|
87
|
-
schedule:
|
88
|
-
- cron: '0 1 * * *'
|