continuous-delivery-scripts 3.2.6__tar.gz → 3.4.0__tar.gz
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.
- {continuous_delivery_scripts-3.2.6/continuous_delivery_scripts.egg-info → continuous_delivery_scripts-3.4.0}/PKG-INFO +4 -2
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/README.md +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/__init__.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/_version.py +6 -5
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/assert_news.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/create_news_file.py +2 -1
- continuous_delivery_scripts-3.4.0/continuous_delivery_scripts/detect_secrets.py +93 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/generate_docs.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/generate_news.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/get_config.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/get_version.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/language_specifics.py +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/license_files.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/GOLAND.MD +1 -2
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/__init__.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/basic.py +11 -5
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/ci.py +15 -6
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/docker.py +11 -5
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/github_actions.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/golang.py +104 -38
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/noop.py +11 -5
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/python.py +48 -14
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/report_third_party_ip.py +20 -7
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/__init__.py +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/spdx_dependency.py +9 -4
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/spdx_document.py +40 -19
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/spdx_file.py +23 -13
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/spdx_helpers.py +39 -8
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/spdx_package.py +29 -19
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/spdx_project.py +21 -9
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/spdx_summary.py +30 -12
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/tag_and_release.py +33 -9
- continuous_delivery_scripts-3.4.0/continuous_delivery_scripts/update_secrets_registry.py +105 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/__init__.py +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/aws_helpers.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/configuration.py +17 -4
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/definitions.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/filesystem_helpers.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/git_helpers.py +30 -6
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/hash_helpers.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/language_specifics_base.py +14 -5
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/logging.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/news_file.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/noop/__init__.py +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/noop/package_helpers.py +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/package_helpers.py +18 -15
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/python/__init__.py +1 -1
- continuous_delivery_scripts-3.4.0/continuous_delivery_scripts/utils/python/package_helpers.py +147 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/python/python_helpers.py +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/string_helpers.py +2 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/third_party_licences.py +25 -7
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/utils/versioning.py +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0/continuous_delivery_scripts.egg-info}/PKG-INFO +4 -2
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts.egg-info/SOURCES.txt +2 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts.egg-info/entry_points.txt +2 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts.egg-info/requires.txt +2 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/pyproject.toml +1 -1
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/setup.py +7 -1
- continuous_delivery_scripts-3.2.6/continuous_delivery_scripts/utils/python/package_helpers.py +0 -87
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/LICENSE +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/MANIFEST.in +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/BASIC.MD +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/CI.MD +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/GITHUB_ACTIONS.MD +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/NOOP.MD +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/plugins/PYTHON.MD +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/templates/third_party_IP_report.csv.jinja2 +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/templates/third_party_IP_report.html.jinja2 +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts/spdx_report/templates/third_party_IP_report.txt.jinja2 +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts.egg-info/dependency_links.txt +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/continuous_delivery_scripts.egg-info/top_level.txt +0 -0
- {continuous_delivery_scripts-3.2.6 → continuous_delivery_scripts-3.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: continuous-delivery-scripts
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.4.0
|
|
4
4
|
Summary: Continuous Delivery scripts to increase automation
|
|
5
5
|
Home-page: https://github.com/ARMmbed/continuous-delivery-scripts
|
|
6
6
|
Author: CMSIS team
|
|
@@ -19,6 +19,7 @@ Classifier: Topic :: Software Development :: Build Tools
|
|
|
19
19
|
Requires-Python: >=3.8,<4
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
+
Requires-Dist: setuptools
|
|
22
23
|
Requires-Dist: gitpython
|
|
23
24
|
Requires-Dist: towncrier==22.12.0
|
|
24
25
|
Requires-Dist: pyautoversion~=1.2.0
|
|
@@ -28,6 +29,7 @@ Requires-Dist: semver~=2.13.0
|
|
|
28
29
|
Requires-Dist: python-dotenv
|
|
29
30
|
Requires-Dist: twine
|
|
30
31
|
Requires-Dist: boto3
|
|
32
|
+
Requires-Dist: detect-secrets[gibberish]==1.5.0
|
|
31
33
|
Requires-Dist: packaging
|
|
32
34
|
Requires-Dist: licenseheaders<0.8.9
|
|
33
35
|
Requires-Dist: spdx-tools==0.6.1
|
|
@@ -51,7 +53,7 @@ Dynamic: requires-python
|
|
|
51
53
|
Dynamic: summary
|
|
52
54
|
|
|
53
55
|
<!--
|
|
54
|
-
Copyright (C) 2020-
|
|
56
|
+
Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
55
57
|
SPDX-License-Identifier: Apache-2.0
|
|
56
58
|
-->
|
|
57
59
|
# Automation Scripts for CI/CD
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
Copyright (C) 2020-
|
|
2
|
+
Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
-->
|
|
5
5
|
# Automation Scripts for CI/CD
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Scripts and utilities used by the CI pipeline."""
|
|
6
|
+
|
|
6
7
|
from continuous_delivery_scripts._version import __version__ # noqa: F401
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""The version number is based on semantic versioning.
|
|
@@ -10,8 +10,9 @@ References
|
|
|
10
10
|
|
|
11
11
|
This file is autogenerated, do not modify by hand.
|
|
12
12
|
"""
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
__version__ = "3.4.0"
|
|
15
|
+
COMMIT = "593860a336acbead96e80e1a5c55aee240dbf97e"
|
|
15
16
|
MAJOR = 3
|
|
16
|
-
MINOR =
|
|
17
|
-
PATCH =
|
|
17
|
+
MINOR = 4
|
|
18
|
+
PATCH = 0
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Checks if valid news files are created for changes in the project."""
|
|
6
|
+
|
|
6
7
|
import argparse
|
|
7
8
|
import logging
|
|
8
9
|
import pathlib
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Easy news files generation.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
Usage:
|
|
8
8
|
create-news-file "Fixed a bug" --type bugfix
|
|
9
9
|
"""
|
|
10
|
+
|
|
10
11
|
import argparse
|
|
11
12
|
import logging
|
|
12
13
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
"""Check tracked files against the project's recorded secret registry."""
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
import logging
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import List, Optional
|
|
13
|
+
|
|
14
|
+
from continuous_delivery_scripts.update_secrets_registry import (
|
|
15
|
+
_determine_exclude_files,
|
|
16
|
+
_get_secrets_baseline_file,
|
|
17
|
+
_get_secrets_baseline_filename,
|
|
18
|
+
)
|
|
19
|
+
from continuous_delivery_scripts.utils.git_helpers import ProjectGitWrapper
|
|
20
|
+
from continuous_delivery_scripts.utils.logging import log_exception, set_log_level
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _generate_detect_secrets_hook_command_list(
|
|
26
|
+
baseline_file: Path, exclude_files: List[str], tracked_files: List[str]
|
|
27
|
+
) -> List[str]:
|
|
28
|
+
command = ["detect-secrets-hook", "--baseline", str(baseline_file)]
|
|
29
|
+
for exclude_file in exclude_files:
|
|
30
|
+
command.extend(["--exclude-files", exclude_file])
|
|
31
|
+
command.extend(tracked_files)
|
|
32
|
+
return command
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _filter_tracked_files(tracked_files: List[str], project_root: Path, registry_file: Path) -> List[str]:
|
|
36
|
+
"""Remove the registry file from tracked files to avoid scanning recorded accepted findings."""
|
|
37
|
+
try:
|
|
38
|
+
registry_relative_path = registry_file.relative_to(project_root).as_posix()
|
|
39
|
+
except ValueError:
|
|
40
|
+
return tracked_files
|
|
41
|
+
return [path for path in tracked_files if path != registry_relative_path]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def detect_secrets(baseline_file: Optional[Path] = None) -> None:
|
|
45
|
+
"""Check tracked files so new secrets are not introduced."""
|
|
46
|
+
git = ProjectGitWrapper()
|
|
47
|
+
project_root = Path(str(git.root))
|
|
48
|
+
resolved_baseline = _get_secrets_baseline_file(baseline_file)
|
|
49
|
+
tracked_files = _filter_tracked_files(git.list_tracked_files(), project_root, resolved_baseline)
|
|
50
|
+
if not tracked_files:
|
|
51
|
+
logger.info("No tracked files found for detect-secrets.")
|
|
52
|
+
return
|
|
53
|
+
subprocess.check_call(
|
|
54
|
+
_generate_detect_secrets_hook_command_list(resolved_baseline, _determine_exclude_files(), tracked_files),
|
|
55
|
+
cwd=str(project_root),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def main() -> int:
|
|
60
|
+
"""Script CLI."""
|
|
61
|
+
parser = argparse.ArgumentParser(
|
|
62
|
+
description=(
|
|
63
|
+
"Check tracked files against the recorded secret registry so new secrets are not committed. "
|
|
64
|
+
"This uses Yelp detect-secrets (https://github.com/Yelp/detect-secrets)."
|
|
65
|
+
)
|
|
66
|
+
)
|
|
67
|
+
parser.add_argument(
|
|
68
|
+
"-r",
|
|
69
|
+
"--registry-file",
|
|
70
|
+
default=Path(_get_secrets_baseline_filename()),
|
|
71
|
+
help="Secret registry file to use.",
|
|
72
|
+
type=Path,
|
|
73
|
+
)
|
|
74
|
+
parser.add_argument(
|
|
75
|
+
"-v",
|
|
76
|
+
"--verbose",
|
|
77
|
+
action="count",
|
|
78
|
+
default=0,
|
|
79
|
+
help="Verbosity, by default errors are reported.",
|
|
80
|
+
)
|
|
81
|
+
args = parser.parse_args()
|
|
82
|
+
set_log_level(args.verbose)
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
detect_secrets(args.registry_file)
|
|
86
|
+
return 0
|
|
87
|
+
except Exception as e:
|
|
88
|
+
log_exception(logger, e)
|
|
89
|
+
return 1
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == "__main__":
|
|
93
|
+
sys.exit(main())
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Generates documentation."""
|
|
6
|
+
|
|
6
7
|
import argparse
|
|
7
8
|
import logging
|
|
8
9
|
import os
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Handles usage of towncrier for automated changelog generation and pyautoversion for versioning."""
|
|
6
|
+
|
|
6
7
|
import sys
|
|
7
8
|
|
|
8
9
|
import argparse
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Retrieves configuration values."""
|
|
6
|
+
|
|
6
7
|
import argparse
|
|
7
8
|
import sys
|
|
8
9
|
import logging
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Determine the project new version."""
|
|
6
|
+
|
|
6
7
|
import sys
|
|
7
8
|
|
|
8
9
|
from typing import Optional
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Language plugins Loader."""
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Apply copyright and licensing to all source files present in a project.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
This is to comply with OpenChain certification;
|
|
8
8
|
https://github.com/OpenChain-Project/Curriculum/blob/master/guides/reusing_software.md#2-include-a-copyright-notice-and-license-in-each-file
|
|
9
9
|
"""
|
|
10
|
+
|
|
10
11
|
import argparse
|
|
11
12
|
import logging
|
|
12
13
|
import subprocess
|
|
@@ -9,5 +9,4 @@ The plugin leverages [goreleaser](https://goreleaser.com/) to package and releas
|
|
|
9
9
|
Therefore, a `.goreleaser.yml` file must be present in the go source directory i.e. where the mod file lies.
|
|
10
10
|
|
|
11
11
|
## Documentation
|
|
12
|
-
The plugin uses [
|
|
13
|
-
It currently uses version 0.4.1 as later versions comprise [an issue](https://github.com/go101/golds/issues/26)
|
|
12
|
+
The plugin uses [doc2go](https://abhinav.github.io/doc2go) to generate the code reference documentation.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Language specific actions."""
|
|
6
|
+
|
|
6
7
|
import glob
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Basic plugin."""
|
|
6
|
+
|
|
6
7
|
import logging
|
|
7
8
|
from pathlib import Path
|
|
8
|
-
from typing import Optional
|
|
9
|
+
from typing import TYPE_CHECKING, Optional
|
|
9
10
|
|
|
10
|
-
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
11
11
|
from continuous_delivery_scripts.utils.definitions import CommitType
|
|
12
|
-
from continuous_delivery_scripts.utils.language_specifics_base import
|
|
12
|
+
from continuous_delivery_scripts.utils.language_specifics_base import (
|
|
13
|
+
BaseLanguage,
|
|
14
|
+
get_language_from_file_name,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
13
19
|
|
|
14
20
|
logger = logging.getLogger(__name__)
|
|
15
21
|
|
|
@@ -45,6 +51,6 @@ class Basic(BaseLanguage):
|
|
|
45
51
|
"""States whether project metadata can be retrieved."""
|
|
46
52
|
return False
|
|
47
53
|
|
|
48
|
-
def get_current_spdx_project(self) -> Optional[SpdxProject]:
|
|
54
|
+
def get_current_spdx_project(self) -> Optional["SpdxProject"]:
|
|
49
55
|
"""Basic."""
|
|
50
56
|
return None
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Plugin for CI projects."""
|
|
6
|
+
|
|
6
7
|
import logging
|
|
7
8
|
from pathlib import Path
|
|
8
|
-
from typing import Optional
|
|
9
|
+
from typing import TYPE_CHECKING, Optional
|
|
9
10
|
|
|
10
|
-
from continuous_delivery_scripts.
|
|
11
|
-
|
|
11
|
+
from continuous_delivery_scripts.utils.configuration import (
|
|
12
|
+
configuration,
|
|
13
|
+
ConfigurationVariable,
|
|
14
|
+
)
|
|
12
15
|
from continuous_delivery_scripts.utils.definitions import CommitType
|
|
13
|
-
from continuous_delivery_scripts.utils.language_specifics_base import
|
|
16
|
+
from continuous_delivery_scripts.utils.language_specifics_base import (
|
|
17
|
+
BaseLanguage,
|
|
18
|
+
get_language_from_file_name,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
14
23
|
|
|
15
24
|
logger = logging.getLogger(__name__)
|
|
16
25
|
|
|
@@ -52,7 +61,7 @@ class CI(BaseLanguage):
|
|
|
52
61
|
"""States whether project metadata can be retrieved."""
|
|
53
62
|
return False
|
|
54
63
|
|
|
55
|
-
def get_current_spdx_project(self) -> Optional[SpdxProject]:
|
|
64
|
+
def get_current_spdx_project(self) -> Optional["SpdxProject"]:
|
|
56
65
|
"""Gets current SPDX description."""
|
|
57
66
|
# TODO
|
|
58
67
|
return None
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Plugin for Docker projects."""
|
|
6
|
+
|
|
6
7
|
import logging
|
|
7
8
|
from pathlib import Path
|
|
8
|
-
from typing import Optional
|
|
9
|
+
from typing import TYPE_CHECKING, Optional
|
|
9
10
|
|
|
10
|
-
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
11
11
|
from continuous_delivery_scripts.utils.definitions import CommitType
|
|
12
|
-
from continuous_delivery_scripts.utils.language_specifics_base import
|
|
12
|
+
from continuous_delivery_scripts.utils.language_specifics_base import (
|
|
13
|
+
BaseLanguage,
|
|
14
|
+
get_language_from_file_name,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
13
19
|
|
|
14
20
|
logger = logging.getLogger(__name__)
|
|
15
21
|
|
|
@@ -47,7 +53,7 @@ class Docker(BaseLanguage):
|
|
|
47
53
|
"""States whether project metadata can be retrieved."""
|
|
48
54
|
return False
|
|
49
55
|
|
|
50
|
-
def get_current_spdx_project(self) -> Optional[SpdxProject]:
|
|
56
|
+
def get_current_spdx_project(self) -> Optional["SpdxProject"]:
|
|
51
57
|
"""Gets current SPDX description."""
|
|
52
58
|
# TODO
|
|
53
59
|
return None
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Plugin for CI projects."""
|
|
6
|
+
|
|
6
7
|
import logging
|
|
7
8
|
import os
|
|
8
9
|
from pathlib import Path
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""Plugin for Golang projects."""
|
|
6
|
+
|
|
6
7
|
import logging
|
|
7
8
|
import os
|
|
9
|
+
import shutil
|
|
8
10
|
from pathlib import Path
|
|
9
|
-
from subprocess import check_call
|
|
10
|
-
from typing import Optional, List, Dict
|
|
11
|
+
from subprocess import check_call, check_output
|
|
12
|
+
from typing import TYPE_CHECKING, Optional, List, Dict, MutableMapping
|
|
11
13
|
|
|
12
|
-
from continuous_delivery_scripts.
|
|
13
|
-
|
|
14
|
+
from continuous_delivery_scripts.utils.configuration import (
|
|
15
|
+
configuration,
|
|
16
|
+
ConfigurationVariable,
|
|
17
|
+
)
|
|
14
18
|
from continuous_delivery_scripts.utils.definitions import CommitType
|
|
15
|
-
from continuous_delivery_scripts.utils.git_helpers import
|
|
16
|
-
|
|
19
|
+
from continuous_delivery_scripts.utils.git_helpers import (
|
|
20
|
+
LocalProjectRepository,
|
|
21
|
+
GitWrapper,
|
|
22
|
+
)
|
|
23
|
+
from continuous_delivery_scripts.utils.language_specifics_base import (
|
|
24
|
+
BaseLanguage,
|
|
25
|
+
get_language_from_file_name,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
if TYPE_CHECKING:
|
|
29
|
+
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
17
30
|
|
|
18
31
|
logger = logging.getLogger(__name__)
|
|
19
32
|
|
|
@@ -25,14 +38,11 @@ ENVVAR_GO_MOD = "GO111MODULE"
|
|
|
25
38
|
GO_MOD_ON_VALUE = "on"
|
|
26
39
|
|
|
27
40
|
|
|
28
|
-
def
|
|
41
|
+
def _generate_doc2go_command_list(output_directory: Path, module: str) -> List[str]:
|
|
29
42
|
return [
|
|
30
|
-
"
|
|
31
|
-
"-
|
|
32
|
-
|
|
33
|
-
"-only-list-exporteds",
|
|
34
|
-
f"-dir={str(output_directory)}",
|
|
35
|
-
"-nouses",
|
|
43
|
+
"doc2go",
|
|
44
|
+
"-out",
|
|
45
|
+
str(output_directory),
|
|
36
46
|
f"{module}",
|
|
37
47
|
]
|
|
38
48
|
|
|
@@ -54,12 +64,12 @@ def _generate_goreleaser_check_command_list() -> List[str]:
|
|
|
54
64
|
]
|
|
55
65
|
|
|
56
66
|
|
|
57
|
-
def
|
|
67
|
+
def _install_doc2go_command_list() -> List[str]:
|
|
58
68
|
return [
|
|
59
69
|
"go",
|
|
60
70
|
"install",
|
|
61
|
-
"
|
|
62
|
-
]
|
|
71
|
+
"go.abhg.dev/doc2go@latest",
|
|
72
|
+
]
|
|
63
73
|
|
|
64
74
|
|
|
65
75
|
def _install_syft_command_list() -> List[str]:
|
|
@@ -70,29 +80,63 @@ def _install_goreleaser_command_list() -> List[str]:
|
|
|
70
80
|
return ["go", "install", "github.com/goreleaser/goreleaser/v2@latest"]
|
|
71
81
|
|
|
72
82
|
|
|
73
|
-
def
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
def _ensure_go_tool_installed(
|
|
84
|
+
tool_name: str,
|
|
85
|
+
version_command: List[str],
|
|
86
|
+
install_command: List[str],
|
|
87
|
+
env: MutableMapping[str, str],
|
|
88
|
+
) -> None:
|
|
89
|
+
"""Ensure a Go-based tool is available on PATH before use."""
|
|
90
|
+
tool_path = shutil.which(tool_name)
|
|
91
|
+
if tool_path:
|
|
92
|
+
try:
|
|
93
|
+
check_output(version_command, env=env)
|
|
94
|
+
logger.info("Using %s from PATH: %s", tool_name, tool_path)
|
|
95
|
+
return
|
|
96
|
+
except Exception as exception:
|
|
97
|
+
logger.warning("Could not use %s from PATH: %s", tool_name, exception)
|
|
98
|
+
|
|
99
|
+
logger.info("Installing %s with go install.", tool_name)
|
|
100
|
+
check_call(install_command, env=env)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _call_doc2go(output_directory: Path, module: str) -> None:
|
|
104
|
+
"""Call doc2go for generating the docs."""
|
|
76
105
|
env = os.environ
|
|
77
106
|
env[ENVVAR_GO_MOD] = GO_MOD_ON_VALUE
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
logger.warning(
|
|
84
|
-
"Currently not running golds because there is an issue with latest versions: "
|
|
85
|
-
+ "https://github.com/go101/golds/issues/26"
|
|
107
|
+
_ensure_go_tool_installed(
|
|
108
|
+
tool_name="doc2go",
|
|
109
|
+
version_command=["doc2go", "-version"],
|
|
110
|
+
install_command=_install_doc2go_command_list(),
|
|
111
|
+
env=env,
|
|
86
112
|
)
|
|
113
|
+
logger.info("Creating Code documentation.")
|
|
114
|
+
logger.info("Running doc2go over [%s] in [%s].", module, SRC_DIR)
|
|
115
|
+
# FIXME enable doc2go when fully tested
|
|
116
|
+
# check_call(
|
|
117
|
+
# _generate_doc2go_command_list(output_directory, module),
|
|
118
|
+
# cwd=str(SRC_DIR),
|
|
119
|
+
# env=env,
|
|
120
|
+
# )
|
|
121
|
+
logger.warning("Currently not running doc2go")
|
|
87
122
|
|
|
88
123
|
|
|
89
124
|
def _call_goreleaser_check(version: str) -> None:
|
|
90
125
|
"""Calls go releaser check to verify configuration."""
|
|
91
|
-
logger.info("Installing GoReleaser if missing.")
|
|
92
126
|
env = os.environ
|
|
93
127
|
env[ENVVAR_GO_MOD] = GO_MOD_ON_VALUE
|
|
94
|
-
|
|
95
|
-
|
|
128
|
+
_ensure_go_tool_installed(
|
|
129
|
+
tool_name="syft",
|
|
130
|
+
version_command=["syft", "--version"],
|
|
131
|
+
install_command=_install_syft_command_list(),
|
|
132
|
+
env=env,
|
|
133
|
+
)
|
|
134
|
+
_ensure_go_tool_installed(
|
|
135
|
+
tool_name="goreleaser",
|
|
136
|
+
version_command=["goreleaser", "--version"],
|
|
137
|
+
install_command=_install_goreleaser_command_list(),
|
|
138
|
+
env=env,
|
|
139
|
+
)
|
|
96
140
|
logger.info("Checking GoReleaser configuration.")
|
|
97
141
|
env[ENVVAR_GORELEASER_CUSTOMISED_TAG] = version
|
|
98
142
|
env[ENVVAR_GORELEASER_GIT_TOKEN] = configuration.get_value(ConfigurationVariable.GIT_TOKEN)
|
|
@@ -124,7 +168,7 @@ class Go(BaseLanguage):
|
|
|
124
168
|
|
|
125
169
|
def get_related_language(self) -> str:
|
|
126
170
|
"""Gets the related language."""
|
|
127
|
-
return get_language_from_file_name(__file__)
|
|
171
|
+
return str(get_language_from_file_name(__file__))
|
|
128
172
|
|
|
129
173
|
def get_version_tag(self, version: str) -> str:
|
|
130
174
|
"""Gets tag based on version."""
|
|
@@ -149,7 +193,7 @@ class Go(BaseLanguage):
|
|
|
149
193
|
def generate_code_documentation(self, output_directory: Path, module_to_document: str) -> None:
|
|
150
194
|
"""Generates the code documentation."""
|
|
151
195
|
super().generate_code_documentation(output_directory, module_to_document)
|
|
152
|
-
|
|
196
|
+
_call_doc2go(output_directory, module_to_document if module_to_document else "./...")
|
|
153
197
|
|
|
154
198
|
def can_add_licence_headers(self) -> bool:
|
|
155
199
|
"""States that licence headers can be added."""
|
|
@@ -159,7 +203,16 @@ class Go(BaseLanguage):
|
|
|
159
203
|
"""States whether project metadata can be retrieved."""
|
|
160
204
|
return False
|
|
161
205
|
|
|
162
|
-
def
|
|
206
|
+
def get_secret_registry_exclude_files(self) -> List[str]:
|
|
207
|
+
"""Gets additional detect-secrets exclude patterns for Go projects."""
|
|
208
|
+
return [
|
|
209
|
+
r".*go\.sum$",
|
|
210
|
+
r"^\.circleci[\\/].*",
|
|
211
|
+
r"^workflows/.*",
|
|
212
|
+
r"^\.github[\\/]workflows[\\/].*",
|
|
213
|
+
]
|
|
214
|
+
|
|
215
|
+
def get_current_spdx_project(self) -> Optional["SpdxProject"]:
|
|
163
216
|
"""Gets current SPDX description."""
|
|
164
217
|
# TODO
|
|
165
218
|
return None
|
|
@@ -177,11 +230,20 @@ class Go(BaseLanguage):
|
|
|
177
230
|
|
|
178
231
|
def _call_goreleaser_release(self, version: str) -> None:
|
|
179
232
|
"""Calls go releaser release to upload packages."""
|
|
180
|
-
logger.info("Installing GoReleaser if missing.")
|
|
181
233
|
env = os.environ
|
|
182
234
|
env[ENVVAR_GO_MOD] = GO_MOD_ON_VALUE
|
|
183
|
-
|
|
184
|
-
|
|
235
|
+
_ensure_go_tool_installed(
|
|
236
|
+
tool_name="syft",
|
|
237
|
+
version_command=["syft", "--version"],
|
|
238
|
+
install_command=_install_syft_command_list(),
|
|
239
|
+
env=env,
|
|
240
|
+
)
|
|
241
|
+
_ensure_go_tool_installed(
|
|
242
|
+
tool_name="goreleaser",
|
|
243
|
+
version_command=["goreleaser", "--version"],
|
|
244
|
+
install_command=_install_goreleaser_command_list(),
|
|
245
|
+
env=env,
|
|
246
|
+
)
|
|
185
247
|
tag = self.get_version_tag(version)
|
|
186
248
|
# The tag of the release must be retrieved
|
|
187
249
|
# See https://github.com/goreleaser/goreleaser/discussions/1426
|
|
@@ -194,4 +256,8 @@ class Go(BaseLanguage):
|
|
|
194
256
|
changelogPath = configuration.get_value(ConfigurationVariable.CHANGELOG_FILE_PATH)
|
|
195
257
|
env[ENVVAR_GORELEASER_CUSTOMISED_TAG] = tag
|
|
196
258
|
env[ENVVAR_GORELEASER_GIT_TOKEN] = configuration.get_value(ConfigurationVariable.GIT_TOKEN)
|
|
197
|
-
check_call(
|
|
259
|
+
check_call(
|
|
260
|
+
_generate_goreleaser_release_command_list(changelogPath),
|
|
261
|
+
cwd=ROOT_DIR,
|
|
262
|
+
env=env,
|
|
263
|
+
)
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (C) 2020-
|
|
2
|
+
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
#
|
|
5
5
|
"""No Operation plugin."""
|
|
6
|
+
|
|
6
7
|
import logging
|
|
7
8
|
from pathlib import Path
|
|
8
|
-
from typing import Optional, Dict
|
|
9
|
+
from typing import TYPE_CHECKING, Optional, Dict
|
|
9
10
|
|
|
10
|
-
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
11
11
|
from continuous_delivery_scripts.utils.definitions import CommitType
|
|
12
12
|
from continuous_delivery_scripts.utils.git_helpers import GitWrapper
|
|
13
|
-
from continuous_delivery_scripts.utils.language_specifics_base import
|
|
13
|
+
from continuous_delivery_scripts.utils.language_specifics_base import (
|
|
14
|
+
BaseLanguage,
|
|
15
|
+
get_language_from_file_name,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
|
|
14
20
|
|
|
15
21
|
logger = logging.getLogger(__name__)
|
|
16
22
|
|
|
@@ -47,7 +53,7 @@ class NoOp(BaseLanguage):
|
|
|
47
53
|
"""States whether project metadata can be retrieved."""
|
|
48
54
|
return False
|
|
49
55
|
|
|
50
|
-
def get_current_spdx_project(self) -> Optional[SpdxProject]:
|
|
56
|
+
def get_current_spdx_project(self) -> Optional["SpdxProject"]:
|
|
51
57
|
"""No Op."""
|
|
52
58
|
return None
|
|
53
59
|
|