moose-inventory 1.0.8 → 2.0
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 +5 -5
- data/.github/workflows/ci.yml +49 -0
- data/.github/workflows/release.yml +58 -0
- data/.gitignore +1 -1
- data/.gitleaks.toml +9 -0
- data/.rubocop.yml +19 -784
- data/BACKLOG.md +290 -0
- data/Gemfile.lock +95 -0
- data/README.md +38 -9
- data/Rakefile +1 -1
- data/bin/moose-inventory +1 -1
- data/docs/release/publishing.md +109 -0
- data/docs/release/release-readiness.md +55 -0
- data/docs/security-audit-2026-05-21.md +71 -0
- data/docs/security-audit-2026-05-26-rerun.md +75 -0
- data/docs/security-audit-2026-05-26.md +63 -0
- data/lib/moose_inventory/cli/formatter.rb +16 -17
- data/lib/moose_inventory/cli/group.rb +4 -1
- data/lib/moose_inventory/cli/group_add.rb +89 -75
- data/lib/moose_inventory/cli/group_addchild.rb +84 -71
- data/lib/moose_inventory/cli/group_addhost.rb +78 -69
- data/lib/moose_inventory/cli/group_addvar.rb +37 -37
- data/lib/moose_inventory/cli/group_get.rb +23 -26
- data/lib/moose_inventory/cli/group_list.rb +12 -15
- data/lib/moose_inventory/cli/group_listvars.rb +12 -14
- data/lib/moose_inventory/cli/group_rm.rb +104 -76
- data/lib/moose_inventory/cli/group_rmchild.rb +99 -54
- data/lib/moose_inventory/cli/group_rmhost.rb +64 -60
- data/lib/moose_inventory/cli/group_rmvar.rb +5 -5
- data/lib/moose_inventory/cli/helpers.rb +76 -0
- data/lib/moose_inventory/cli/host.rb +4 -1
- data/lib/moose_inventory/cli/host_add.rb +51 -66
- data/lib/moose_inventory/cli/host_addgroup.rb +77 -68
- data/lib/moose_inventory/cli/host_addvar.rb +6 -6
- data/lib/moose_inventory/cli/host_get.rb +15 -18
- data/lib/moose_inventory/cli/host_list.rb +3 -3
- data/lib/moose_inventory/cli/host_listvars.rb +21 -23
- data/lib/moose_inventory/cli/host_rm.rb +9 -9
- data/lib/moose_inventory/cli/host_rmgroup.rb +63 -60
- data/lib/moose_inventory/cli/host_rmvar.rb +3 -3
- data/lib/moose_inventory/config/config.rb +43 -40
- data/lib/moose_inventory/db/db.rb +92 -52
- data/lib/moose_inventory/db/models.rb +11 -12
- data/lib/moose_inventory/inventory_context.rb +50 -0
- data/lib/moose_inventory/operations/add_associations.rb +127 -0
- data/lib/moose_inventory/operations/add_groups.rb +115 -0
- data/lib/moose_inventory/operations/add_hosts.rb +110 -0
- data/lib/moose_inventory/operations/group_child_relations.rb +118 -0
- data/lib/moose_inventory/operations/group_cleanup.rb +55 -0
- data/lib/moose_inventory/operations/remove_associations.rb +101 -0
- data/lib/moose_inventory/operations/remove_groups.rb +79 -0
- data/lib/moose_inventory/version.rb +1 -1
- data/moose-inventory.gemspec +38 -20
- data/scripts/check.sh +10 -0
- data/scripts/ci/check_permissions.sh +35 -0
- data/scripts/ci/check_rubocop.sh +28 -0
- data/scripts/ci/check_secrets.sh +26 -0
- data/scripts/ci/check_security.sh +68 -0
- data/scripts/ci/install_security_tools.sh +47 -0
- data/scripts/ci/package_sanity.sh +46 -0
- data/scripts/files.rb +1 -4
- data/scripts/install_dependencies.sh +19 -0
- data/scripts/reports.sh +2 -2
- data/spec/lib/moose_inventory/cli/cli_spec.rb +13 -14
- data/spec/lib/moose_inventory/cli/group_add_spec.rb +118 -119
- data/spec/lib/moose_inventory/cli/group_addchild_spec.rb +49 -51
- data/spec/lib/moose_inventory/cli/group_addhost_spec.rb +80 -83
- data/spec/lib/moose_inventory/cli/group_addvar_spec.rb +91 -91
- data/spec/lib/moose_inventory/cli/group_get_spec.rb +22 -23
- data/spec/lib/moose_inventory/cli/group_list_spec.rb +19 -20
- data/spec/lib/moose_inventory/cli/group_listvar_spec.rb +35 -36
- data/spec/lib/moose_inventory/cli/group_rm_spec.rb +115 -78
- data/spec/lib/moose_inventory/cli/group_rmchild_spec.rb +86 -45
- data/spec/lib/moose_inventory/cli/group_rmhost_spec.rb +43 -46
- data/spec/lib/moose_inventory/cli/group_rmvar_spec.rb +131 -131
- data/spec/lib/moose_inventory/cli/group_spec.rb +9 -9
- data/spec/lib/moose_inventory/cli/host_add_spec.rb +103 -43
- data/spec/lib/moose_inventory/cli/host_addgroup_spec.rb +78 -80
- data/spec/lib/moose_inventory/cli/host_addvar_spec.rb +122 -122
- data/spec/lib/moose_inventory/cli/host_get_spec.rb +16 -16
- data/spec/lib/moose_inventory/cli/host_list_spec.rb +8 -8
- data/spec/lib/moose_inventory/cli/host_listvar_spec.rb +50 -52
- data/spec/lib/moose_inventory/cli/host_rm_spec.rb +12 -12
- data/spec/lib/moose_inventory/cli/host_rmgroup_spec.rb +48 -51
- data/spec/lib/moose_inventory/cli/host_rmvar_spec.rb +136 -136
- data/spec/lib/moose_inventory/config/config_spec.rb +16 -3
- data/spec/lib/moose_inventory/db/db_spec.rb +386 -2
- data/spec/lib/moose_inventory/db/models_spec.rb +10 -11
- data/spec/lib/moose_inventory/operations/add_associations_spec.rb +77 -0
- data/spec/lib/moose_inventory/operations/add_groups_spec.rb +65 -0
- data/spec/lib/moose_inventory/operations/add_hosts_spec.rb +69 -0
- data/spec/lib/moose_inventory/operations/group_child_relations_spec.rb +76 -0
- data/spec/lib/moose_inventory/operations/remove_associations_spec.rb +78 -0
- data/spec/lib/moose_inventory/operations/remove_groups_spec.rb +57 -0
- data/spec/shared/shared_config_setup.rb +2 -2
- data/spec/spec_helper.rb +7 -8
- metadata +157 -105
- data/.coveralls.yml +0 -0
- data/Guardfile +0 -38
- data/config/dotfiles/coveralls.yml +0 -0
- data/config/dotfiles/gitignore +0 -20
- data/config/dotfiles/rubocop.yml +0 -793
- data/scripts/guard_quality.sh +0 -3
- data/scripts/guard_test.sh +0 -2
data/moose-inventory.gemspec
CHANGED
|
@@ -16,30 +16,48 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
# rubocop:enable Metrics/LineLength
|
|
17
17
|
spec.homepage = 'https://github.com/RusDavies/moose-inventory'
|
|
18
18
|
spec.license = 'MIT'
|
|
19
|
+
spec.required_ruby_version = '>= 3.2'
|
|
19
20
|
|
|
20
21
|
spec.files = `git ls-files -z`.split("\x0")
|
|
21
22
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
22
23
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
23
24
|
spec.require_paths = ['lib']
|
|
24
25
|
|
|
25
|
-
spec.add_runtime_dependency 'indentation', '~> 0.1'
|
|
26
|
-
spec.add_runtime_dependency 'json', '~>1.8'
|
|
27
|
-
spec.add_runtime_dependency 'mysql', '~>2.9'
|
|
28
|
-
#
|
|
29
|
-
spec.add_runtime_dependency '
|
|
30
|
-
spec.add_runtime_dependency '
|
|
31
|
-
spec.add_runtime_dependency '
|
|
32
|
-
spec.add_runtime_dependency '
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
spec.add_development_dependency '
|
|
37
|
-
spec.add_development_dependency '
|
|
38
|
-
spec.add_development_dependency 'guard', '~> 2.12'
|
|
39
|
-
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
|
40
|
-
spec.add_development_dependency 'guard-rubocop',
|
|
41
|
-
spec.add_development_dependency 'rake', '~> 10.1'
|
|
42
|
-
spec.add_development_dependency 'rspec', '~>3.2'
|
|
43
|
-
spec.add_development_dependency 'rubocop', '>= 0.19'
|
|
44
|
-
spec.add_development_dependency 'simplecov', '~> 0.10'
|
|
26
|
+
# spec.add_runtime_dependency 'indentation', '~> 0.1'
|
|
27
|
+
# spec.add_runtime_dependency 'json', '~>1.8'
|
|
28
|
+
# #spec.add_runtime_dependency 'mysql', '~>2.9' # This causes lots of problems. Need to migrate to the newer mysql2.
|
|
29
|
+
# #spec.add_runtime_dependency 'mysql2', '~>0.3'
|
|
30
|
+
# spec.add_runtime_dependency 'mysql2'
|
|
31
|
+
# spec.add_runtime_dependency 'pg', '~>0.17'
|
|
32
|
+
# spec.add_runtime_dependency 'sequel', '~>4.22'
|
|
33
|
+
# spec.add_runtime_dependency 'sqlite3', '~>1.3'
|
|
34
|
+
# spec.add_runtime_dependency 'thor', '~>0.19'
|
|
35
|
+
# # spec.add_runtime_dependency 'yaml', '~>1.0'
|
|
36
|
+
|
|
37
|
+
# spec.add_development_dependency 'bundler', '~> 1.7'
|
|
38
|
+
# spec.add_development_dependency 'coveralls', '~> 0.8'
|
|
39
|
+
# spec.add_development_dependency 'guard', '~> 2.12'
|
|
40
|
+
# spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
|
41
|
+
# spec.add_development_dependency 'guard-rubocop', '~> 1.2'
|
|
42
|
+
# spec.add_development_dependency 'rake', '~> 10.1'
|
|
43
|
+
# spec.add_development_dependency 'rspec', '~>3.2'
|
|
44
|
+
# spec.add_development_dependency 'rubocop', '>= 0.19'
|
|
45
|
+
# spec.add_development_dependency 'simplecov', '~> 0.10'
|
|
46
|
+
|
|
47
|
+
spec.add_runtime_dependency 'indentation', '~> 0'
|
|
48
|
+
spec.add_runtime_dependency 'json', '>= 2.7', '< 3'
|
|
49
|
+
spec.add_runtime_dependency 'mysql2', '>= 0.5.7', '< 0.6'
|
|
50
|
+
spec.add_runtime_dependency 'pg', '>= 1.5', '< 2'
|
|
51
|
+
spec.add_runtime_dependency 'sequel', '>= 5.80', '< 6'
|
|
52
|
+
spec.add_runtime_dependency 'sqlite3', '>= 1.7', '< 3'
|
|
53
|
+
spec.add_runtime_dependency 'thor', '>= 1.3', '< 2'
|
|
54
|
+
|
|
55
|
+
spec.add_development_dependency 'bundler', '>= 2.2.33', '< 3'
|
|
56
|
+
spec.add_development_dependency 'bundler-audit', '>= 0.9', '< 1'
|
|
57
|
+
spec.add_development_dependency 'parallel', '>= 1.10', '< 2.0'
|
|
58
|
+
spec.add_development_dependency 'rake', '>= 13.0', '< 14'
|
|
59
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
|
60
|
+
spec.add_development_dependency 'rubocop', '>= 1.72', '< 2'
|
|
61
|
+
spec.add_development_dependency 'simplecov', '~> 0'
|
|
62
|
+
|
|
45
63
|
end
|
data/scripts/check.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
allowed_executables=(
|
|
5
|
+
"bin/moose-inventory"
|
|
6
|
+
"scripts/check.sh"
|
|
7
|
+
"scripts/ci/check_permissions.sh"
|
|
8
|
+
"scripts/ci/check_rubocop.sh"
|
|
9
|
+
"scripts/ci/check_secrets.sh"
|
|
10
|
+
"scripts/ci/check_security.sh"
|
|
11
|
+
"scripts/ci/install_security_tools.sh"
|
|
12
|
+
"scripts/ci/package_sanity.sh"
|
|
13
|
+
"scripts/files.rb"
|
|
14
|
+
"scripts/install_dependencies.sh"
|
|
15
|
+
"scripts/reports.sh"
|
|
16
|
+
"scripts/work-through.sh"
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
allowed_file="$(mktemp)"
|
|
20
|
+
actual_file="$(mktemp)"
|
|
21
|
+
trap 'rm -f "$allowed_file" "$actual_file"' EXIT
|
|
22
|
+
|
|
23
|
+
printf '%s\n' "${allowed_executables[@]}" | sort > "$allowed_file"
|
|
24
|
+
|
|
25
|
+
git ls-files -z | while IFS= read -r -d '' path; do
|
|
26
|
+
if [[ -x "$path" ]]; then
|
|
27
|
+
printf '%s\n' "$path"
|
|
28
|
+
fi
|
|
29
|
+
done | sort > "$actual_file"
|
|
30
|
+
|
|
31
|
+
if ! diff -u "$allowed_file" "$actual_file"; then
|
|
32
|
+
echo "Unexpected executable file permissions detected." >&2
|
|
33
|
+
echo "Update scripts/ci/check_permissions.sh only when a new executable entrypoint is intentional." >&2
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
bundle exec rubocop \
|
|
5
|
+
lib/moose_inventory/inventory_context.rb \
|
|
6
|
+
lib/moose_inventory/operations/add_hosts.rb \
|
|
7
|
+
lib/moose_inventory/operations/add_groups.rb \
|
|
8
|
+
lib/moose_inventory/operations/add_associations.rb \
|
|
9
|
+
lib/moose_inventory/operations/remove_associations.rb \
|
|
10
|
+
lib/moose_inventory/operations/group_cleanup.rb \
|
|
11
|
+
lib/moose_inventory/operations/group_child_relations.rb \
|
|
12
|
+
lib/moose_inventory/operations/remove_groups.rb \
|
|
13
|
+
lib/moose_inventory/cli/helpers.rb \
|
|
14
|
+
lib/moose_inventory/cli/host_add.rb \
|
|
15
|
+
lib/moose_inventory/cli/group_add.rb \
|
|
16
|
+
lib/moose_inventory/cli/host_addgroup.rb \
|
|
17
|
+
lib/moose_inventory/cli/group_addhost.rb \
|
|
18
|
+
lib/moose_inventory/cli/host_rmgroup.rb \
|
|
19
|
+
lib/moose_inventory/cli/group_rmhost.rb \
|
|
20
|
+
lib/moose_inventory/cli/group_addchild.rb \
|
|
21
|
+
lib/moose_inventory/cli/group_rmchild.rb \
|
|
22
|
+
lib/moose_inventory/cli/group_rm.rb \
|
|
23
|
+
spec/lib/moose_inventory/operations/add_hosts_spec.rb \
|
|
24
|
+
spec/lib/moose_inventory/operations/add_groups_spec.rb \
|
|
25
|
+
spec/lib/moose_inventory/operations/add_associations_spec.rb \
|
|
26
|
+
spec/lib/moose_inventory/operations/remove_associations_spec.rb \
|
|
27
|
+
spec/lib/moose_inventory/operations/group_child_relations_spec.rb \
|
|
28
|
+
spec/lib/moose_inventory/operations/remove_groups_spec.rb
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
BIN_DIR="${MOOSE_INVENTORY_SECURITY_TOOLS_BIN:-$PWD/tmp/security-tools/bin}"
|
|
5
|
+
if command -v gitleaks >/dev/null 2>&1; then
|
|
6
|
+
GITLEAKS=(gitleaks)
|
|
7
|
+
elif [ -x "$BIN_DIR/gitleaks" ]; then
|
|
8
|
+
GITLEAKS=("$BIN_DIR/gitleaks")
|
|
9
|
+
else
|
|
10
|
+
if [ "${MOOSE_INVENTORY_REQUIRE_SECURITY_TOOLS:-0}" = "1" ]; then
|
|
11
|
+
echo "gitleaks is required but was not found. Run scripts/ci/install_security_tools.sh first." >&2
|
|
12
|
+
exit 2
|
|
13
|
+
fi
|
|
14
|
+
echo "gitleaks not found; skipping dedicated secret scan."
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
"${GITLEAKS[@]}" detect \
|
|
19
|
+
--no-git \
|
|
20
|
+
--source . \
|
|
21
|
+
--config .gitleaks.toml \
|
|
22
|
+
--redact \
|
|
23
|
+
--no-banner \
|
|
24
|
+
--log-level warn
|
|
25
|
+
|
|
26
|
+
echo "Gitleaks secret scan passed."
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
python3 - <<'PY'
|
|
5
|
+
import json
|
|
6
|
+
import sys
|
|
7
|
+
import urllib.error
|
|
8
|
+
import urllib.request
|
|
9
|
+
|
|
10
|
+
specs = []
|
|
11
|
+
for line in open('Gemfile.lock', encoding='utf-8'):
|
|
12
|
+
item = line.strip()
|
|
13
|
+
if not item or ' (' not in item:
|
|
14
|
+
continue
|
|
15
|
+
if item.startswith('moose-inventory'):
|
|
16
|
+
continue
|
|
17
|
+
name = item.split(' (', 1)[0]
|
|
18
|
+
version = item.split(' (', 1)[1].split(')', 1)[0].split('-', 1)[0]
|
|
19
|
+
if name and name[0].isalpha():
|
|
20
|
+
specs.append((name, version))
|
|
21
|
+
|
|
22
|
+
queries = [
|
|
23
|
+
{'package': {'name': name, 'ecosystem': 'RubyGems'}, 'version': version}
|
|
24
|
+
for name, version in specs
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
request = urllib.request.Request(
|
|
28
|
+
'https://api.osv.dev/v1/querybatch',
|
|
29
|
+
data=json.dumps({'queries': queries}).encode('utf-8'),
|
|
30
|
+
headers={'Content-Type': 'application/json'},
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
with urllib.request.urlopen(request, timeout=30) as response:
|
|
35
|
+
data = json.load(response)
|
|
36
|
+
except (urllib.error.URLError, TimeoutError) as exc:
|
|
37
|
+
print(f'OSV dependency check failed: {exc}', file=sys.stderr)
|
|
38
|
+
sys.exit(2)
|
|
39
|
+
|
|
40
|
+
findings = []
|
|
41
|
+
for (name, version), result in zip(specs, data.get('results', [])):
|
|
42
|
+
for vuln in result.get('vulns') or []:
|
|
43
|
+
findings.append((name, version, vuln.get('id', 'unknown'), vuln.get('summary') or ''))
|
|
44
|
+
|
|
45
|
+
print(f'OSV dependency check: queried={len(specs)} vulnerable={len(findings)}')
|
|
46
|
+
if findings:
|
|
47
|
+
for name, version, vuln_id, summary in findings:
|
|
48
|
+
print(f'- {name} {version}: {vuln_id} {summary}', file=sys.stderr)
|
|
49
|
+
sys.exit(1)
|
|
50
|
+
PY
|
|
51
|
+
|
|
52
|
+
bundle exec bundle-audit check --update
|
|
53
|
+
|
|
54
|
+
BIN_DIR="${MOOSE_INVENTORY_SECURITY_TOOLS_BIN:-$PWD/tmp/security-tools/bin}"
|
|
55
|
+
if command -v osv-scanner >/dev/null 2>&1; then
|
|
56
|
+
OSV_SCANNER=(osv-scanner)
|
|
57
|
+
elif [ -x "$BIN_DIR/osv-scanner" ]; then
|
|
58
|
+
OSV_SCANNER=("$BIN_DIR/osv-scanner")
|
|
59
|
+
else
|
|
60
|
+
if [ "${MOOSE_INVENTORY_REQUIRE_SECURITY_TOOLS:-0}" = "1" ]; then
|
|
61
|
+
echo "osv-scanner is required but was not found. Run scripts/ci/install_security_tools.sh first." >&2
|
|
62
|
+
exit 2
|
|
63
|
+
fi
|
|
64
|
+
echo "osv-scanner not found; skipping osv-scanner lockfile scan."
|
|
65
|
+
exit 0
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
"${OSV_SCANNER[@]}" scan source --lockfile Gemfile.lock .
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Installs optional security audit CLIs used by CI. They are kept out of the
|
|
5
|
+
# gem runtime/development bundle because they are Go command-line tools, not
|
|
6
|
+
# Ruby dependencies.
|
|
7
|
+
|
|
8
|
+
BIN_DIR="${MOOSE_INVENTORY_SECURITY_TOOLS_BIN:-$PWD/tmp/security-tools/bin}"
|
|
9
|
+
GITLEAKS_VERSION="${GITLEAKS_VERSION:-v8.30.0}"
|
|
10
|
+
OSV_SCANNER_VERSION="${OSV_SCANNER_VERSION:-v2.2.3}"
|
|
11
|
+
|
|
12
|
+
mkdir -p "$BIN_DIR"
|
|
13
|
+
|
|
14
|
+
if ! command -v go >/dev/null 2>&1; then
|
|
15
|
+
echo "Go is required to install gitleaks/osv-scanner. Install Go or use a prebuilt package." >&2
|
|
16
|
+
exit 2
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
install_go_tool() {
|
|
20
|
+
local name="$1"
|
|
21
|
+
local module="$2"
|
|
22
|
+
local version="$3"
|
|
23
|
+
|
|
24
|
+
if command -v "$name" >/dev/null 2>&1; then
|
|
25
|
+
echo "$name already available at $(command -v "$name")"
|
|
26
|
+
return
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
if [ -x "$BIN_DIR/$name" ]; then
|
|
30
|
+
echo "$name already installed at $BIN_DIR/$name"
|
|
31
|
+
return
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
echo "Installing $name $version into $BIN_DIR"
|
|
35
|
+
GOBIN="$BIN_DIR" go install "$module@$version"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
install_go_tool gitleaks github.com/zricethezav/gitleaks/v8 "$GITLEAKS_VERSION"
|
|
39
|
+
install_go_tool osv-scanner github.com/google/osv-scanner/v2/cmd/osv-scanner "$OSV_SCANNER_VERSION"
|
|
40
|
+
|
|
41
|
+
if [ -n "${GITHUB_PATH:-}" ]; then
|
|
42
|
+
echo "$BIN_DIR" >> "$GITHUB_PATH"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
export PATH="$BIN_DIR:$PATH"
|
|
46
|
+
gitleaks version || true
|
|
47
|
+
osv-scanner --version
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
pkg_dir="tmp/pkg"
|
|
5
|
+
extract_dir="tmp/package-sanity"
|
|
6
|
+
rm -rf "$pkg_dir" "$extract_dir"
|
|
7
|
+
mkdir -p "$pkg_dir" "$extract_dir"
|
|
8
|
+
|
|
9
|
+
gem_path="$pkg_dir/moose-inventory.gem"
|
|
10
|
+
gem build moose-inventory.gemspec --output "$gem_path"
|
|
11
|
+
|
|
12
|
+
gem specification "$gem_path" name --yaml > "$pkg_dir/name.yml"
|
|
13
|
+
gem specification "$gem_path" version --yaml > "$pkg_dir/version.yml"
|
|
14
|
+
gem specification "$gem_path" executables --yaml > "$pkg_dir/executables.yml"
|
|
15
|
+
gem specification "$gem_path" require_paths --yaml > "$pkg_dir/require_paths.yml"
|
|
16
|
+
gem specification "$gem_path" files --yaml > "$pkg_dir/files.yml"
|
|
17
|
+
|
|
18
|
+
tar -xf "$gem_path" -C "$extract_dir"
|
|
19
|
+
tar -xzf "$extract_dir/data.tar.gz" -C "$extract_dir"
|
|
20
|
+
|
|
21
|
+
required_files=(
|
|
22
|
+
"bin/moose-inventory"
|
|
23
|
+
"lib/moose_inventory.rb"
|
|
24
|
+
"lib/moose_inventory/version.rb"
|
|
25
|
+
"README.md"
|
|
26
|
+
"LICENSE.txt"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
for path in "${required_files[@]}"; do
|
|
30
|
+
if [[ ! -f "$extract_dir/$path" ]]; then
|
|
31
|
+
echo "Packaged gem is missing required file: $path" >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
if ! grep -q "^- moose-inventory$" "$pkg_dir/executables.yml"; then
|
|
37
|
+
echo "Packaged gem metadata does not expose the moose-inventory executable." >&2
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if ! bundle exec ruby -Ilib bin/moose-inventory --config spec/config/config.yml version | grep -q '^Version '; then
|
|
42
|
+
echo "CLI version smoke failed." >&2
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
printf 'Package sanity passed: %s\n' "$gem_path"
|
data/scripts/files.rb
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
sudo dnf groupinstall -y "C Development Tools and Libraries" "Development Tools"
|
|
5
|
+
sudo dnf install -y \
|
|
6
|
+
ansible \
|
|
7
|
+
gitleaks \
|
|
8
|
+
golang \
|
|
9
|
+
ruby \
|
|
10
|
+
ruby-devel \
|
|
11
|
+
rubygem-bundler \
|
|
12
|
+
sqlite \
|
|
13
|
+
sqlite-libs \
|
|
14
|
+
sqlite-devel \
|
|
15
|
+
mariadb-connector-c-devel \
|
|
16
|
+
libpq-devel \
|
|
17
|
+
libffi \
|
|
18
|
+
libffi-devel \
|
|
19
|
+
rpm-build
|
data/scripts/reports.sh
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
RSpec.describe Moose::Inventory::Cli::Application do
|
|
4
4
|
before do
|
|
5
5
|
@app = Moose::Inventory::Cli::Application
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
describe
|
|
8
|
+
describe '.version' do
|
|
9
9
|
# --------------------
|
|
10
10
|
it 'method should be responsive' do
|
|
11
11
|
result = @app.instance_methods(false).include?(:version)
|
|
12
12
|
expect(result).to eq(true)
|
|
13
13
|
end
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
# --------------------
|
|
16
|
-
# it 'should output version information' do
|
|
17
|
-
# actual = runner { @app.version }
|
|
18
|
-
#
|
|
19
|
-
# desired = {}
|
|
20
|
-
# desired[:STDERR] = "Version #{Moose::Inventory::VERSION}"
|
|
21
|
-
#
|
|
22
|
-
# expected(actual, desired)
|
|
23
|
-
# end
|
|
24
|
-
|
|
16
|
+
# it 'should output version information' do
|
|
17
|
+
# actual = runner { @app.version }
|
|
18
|
+
#
|
|
19
|
+
# desired = {}
|
|
20
|
+
# desired[:STDERR] = "Version #{Moose::Inventory::VERSION}"
|
|
21
|
+
#
|
|
22
|
+
# expected(actual, desired)
|
|
23
|
+
# end
|
|
25
24
|
end
|
|
26
|
-
|
|
25
|
+
end
|