Skip to content

Commit b6cf3c1

Browse files
committed
🚀 releasing version 2.4.0 @ 2021-08-12 08:35
[skip ci]
1 parent ae3e2e0 commit b6cf3c1

13 files changed

+320
-115
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ This project was forked from version 1.7.4 of [mbed-tools-ci-scripts](https://gi
1717

1818
[//]: # (begin_release_notes)
1919

20+
"2.4.0" (2021-08-12)
21+
====================
22+
23+
Features
24+
--------
25+
26+
- Added a golang plugin (#202108112203)
27+
28+
29+
Improved Documentation
30+
----------------------
31+
32+
- Improved configuration documentation (#202108111714)
33+
34+
2035
"2.3.1" (2021-08-11)
2136
====================
2237

continuous_delivery_scripts/_version.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
1111
This file is autogenerated, do not modify by hand.
1212
"""
13-
__version__ = "2.3.1"
14-
COMMIT = "6979bef81059a20eced2e9ffb599c315ad3ae534"
13+
__version__ = "2.4.0"
14+
COMMIT = "ae3e2e0ca05bd4c1e0dc1a2fc29dc06063fab6d4"
1515
MAJOR = 2
16-
MINOR = 3
17-
PATCH = 1
16+
MINOR = 4
17+
PATCH = 0

docs/plugins/docker.html

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ <h1 class="title">Module <code>continuous_delivery_scripts.plugins.docker</code>
5252
&#34;&#34;&#34;Gets the related language.&#34;&#34;&#34;
5353
return get_language_from_file_name(__file__)
5454

55-
def package_software(self) -&gt; None:
55+
def package_software(self, version: str) -&gt; None:
5656
&#34;&#34;&#34;Todo build docker image.&#34;&#34;&#34;
57-
super().package_software()
57+
super().package_software(version)
5858

59-
def release_package_to_repository(self) -&gt; None:
59+
def release_package_to_repository(self, version: str) -&gt; None:
6060
&#34;&#34;&#34;Todo push image to repository e.g. ecr, artifactory.&#34;&#34;&#34;
61-
super().release_package_to_repository()
61+
super().release_package_to_repository(version)
6262

6363
def check_credentials(self) -&gt; None:
6464
&#34;&#34;&#34;Checks any credentials.&#34;&#34;&#34;
@@ -109,13 +109,13 @@ <h2 class="section-title" id="header-classes">Classes</h2>
109109
&#34;&#34;&#34;Gets the related language.&#34;&#34;&#34;
110110
return get_language_from_file_name(__file__)
111111

112-
def package_software(self) -&gt; None:
112+
def package_software(self, version: str) -&gt; None:
113113
&#34;&#34;&#34;Todo build docker image.&#34;&#34;&#34;
114-
super().package_software()
114+
super().package_software(version)
115115

116-
def release_package_to_repository(self) -&gt; None:
116+
def release_package_to_repository(self, version: str) -&gt; None:
117117
&#34;&#34;&#34;Todo push image to repository e.g. ecr, artifactory.&#34;&#34;&#34;
118-
super().release_package_to_repository()
118+
super().release_package_to_repository(version)
119119

120120
def check_credentials(self) -&gt; None:
121121
&#34;&#34;&#34;Checks any credentials.&#34;&#34;&#34;
@@ -206,31 +206,31 @@ <h3>Methods</h3>
206206
</details>
207207
</dd>
208208
<dt id="continuous_delivery_scripts.plugins.docker.Docker.package_software"><code class="name flex">
209-
<span>def <span class="ident">package_software</span></span>(<span>self) ‑> NoneType</span>
209+
<span>def <span class="ident">package_software</span></span>(<span>self, version: str) ‑> NoneType</span>
210210
</code></dt>
211211
<dd>
212212
<div class="desc"><p>Todo build docker image.</p></div>
213213
<details class="source">
214214
<summary>
215215
<span>Expand source code</span>
216216
</summary>
217-
<pre><code class="python">def package_software(self) -&gt; None:
217+
<pre><code class="python">def package_software(self, version: str) -&gt; None:
218218
&#34;&#34;&#34;Todo build docker image.&#34;&#34;&#34;
219-
super().package_software()</code></pre>
219+
super().package_software(version)</code></pre>
220220
</details>
221221
</dd>
222222
<dt id="continuous_delivery_scripts.plugins.docker.Docker.release_package_to_repository"><code class="name flex">
223-
<span>def <span class="ident">release_package_to_repository</span></span>(<span>self) ‑> NoneType</span>
223+
<span>def <span class="ident">release_package_to_repository</span></span>(<span>self, version: str) ‑> NoneType</span>
224224
</code></dt>
225225
<dd>
226226
<div class="desc"><p>Todo push image to repository e.g. ecr, artifactory.</p></div>
227227
<details class="source">
228228
<summary>
229229
<span>Expand source code</span>
230230
</summary>
231-
<pre><code class="python">def release_package_to_repository(self) -&gt; None:
231+
<pre><code class="python">def release_package_to_repository(self, version: str) -&gt; None:
232232
&#34;&#34;&#34;Todo push image to repository e.g. ecr, artifactory.&#34;&#34;&#34;
233-
super().release_package_to_repository()</code></pre>
233+
super().release_package_to_repository(version)</code></pre>
234234
</details>
235235
</dd>
236236
</dl>
@@ -241,6 +241,7 @@ <h3>Inherited members</h3>
241241
<li><code><a title="continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.can_get_project_metadata" href="../utils/language_specifics_base.html#continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.can_get_project_metadata">can_get_project_metadata</a></code></li>
242242
<li><code><a title="continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.generate_code_documentation" href="../utils/language_specifics_base.html#continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.generate_code_documentation">generate_code_documentation</a></code></li>
243243
<li><code><a title="continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.generate_source_licence_header_template" href="../utils/language_specifics_base.html#continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.generate_source_licence_header_template">generate_source_licence_header_template</a></code></li>
244+
<li><code><a title="continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.get_version_tag" href="../utils/language_specifics_base.html#continuous_delivery_scripts.utils.language_specifics_base.BaseLanguage.get_version_tag">get_version_tag</a></code></li>
244245
</ul>
245246
</li>
246247
</ul>

docs/plugins/golang.html

Lines changed: 120 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,80 @@ <h1 class="title">Module <code>continuous_delivery_scripts.plugins.golang</code>
3737
#
3838
&#34;&#34;&#34;Plugin for Golang projects.&#34;&#34;&#34;
3939
import logging
40+
import os
4041
from pathlib import Path
41-
from typing import Optional
42+
from typing import Optional, List
43+
from subprocess import check_call
4244
from continuous_delivery_scripts.utils.language_specifics_base import BaseLanguage, get_language_from_file_name
4345
from continuous_delivery_scripts.spdx_report.spdx_project import SpdxProject
46+
from continuous_delivery_scripts.utils.configuration import configuration, ConfigurationVariable
4447

4548
logger = logging.getLogger(__name__)
4649

50+
SRC_DIR = configuration.get_value(ConfigurationVariable.SOURCE_DIR)
51+
ENVVAR_GORELEASER_GIT_TOKEN = &#34;GITHUB_TOKEN&#34;
52+
ENVVAR_GORELEASER_CUSTOMISED_TAG = &#34;GORELEASER_CURRENT_TAG&#34;
53+
54+
55+
def _generate_golds_command_list(output_directory: Path, module: str) -&gt; List[str]:
56+
return [&#34;golds&#34;, &#34;-gen&#34;, &#34;-wdpkgs-listing=promoted&#34;, f&#34;-dir={str(output_directory)}&#34;, &#34;-nouses&#34;, f&#34;{module}&#34;]
57+
58+
59+
def _generate_goreleaser_release_command_list(changelog: Path) -&gt; List[str]:
60+
return [
61+
&#34;goreleaser&#34;,
62+
&#34;release&#34;,
63+
&#34;--rm-dist&#34;,
64+
&#34;--release-notes&#34;,
65+
f&#34;{str(changelog)}&#34;,
66+
]
67+
68+
69+
def _generate_goreleaser_check_command_list() -&gt; List[str]:
70+
return [
71+
&#34;goreleaser&#34;,
72+
&#34;check&#34;,
73+
]
74+
75+
76+
def _install_golds_command_list() -&gt; List[str]:
77+
return [&#34;go&#34;, &#34;install&#34;, &#34;go101.org/golds@latest&#34;]
78+
79+
80+
def _install_goreleaser_command_list() -&gt; List[str]:
81+
return [&#34;go&#34;, &#34;install&#34;, &#34;github.com/goreleaser/goreleaser@latest&#34;]
82+
83+
84+
def _call_golds(output_directory: Path, module: str) -&gt; None:
85+
&#34;&#34;&#34;Calls Golds for generating the docs.&#34;&#34;&#34;
86+
logger.info(&#34;Installing Golds if missing.&#34;)
87+
check_call(_install_golds_command_list())
88+
logger.info(&#34;Creating Golds documentation.&#34;)
89+
check_call(_generate_golds_command_list(output_directory, module), cwd=SRC_DIR)
90+
91+
92+
def _call_goreleaser_check(version: str) -&gt; None:
93+
&#34;&#34;&#34;Calls go releaser check to verify configuration.&#34;&#34;&#34;
94+
logger.info(&#34;Installing GoReleaser if missing.&#34;)
95+
check_call(_install_goreleaser_command_list())
96+
logger.info(&#34;Checking GoReleaser configuration.&#34;)
97+
env = os.environ
98+
env[ENVVAR_GORELEASER_CUSTOMISED_TAG] = version
99+
env[ENVVAR_GORELEASER_GIT_TOKEN] = configuration.get_value(ConfigurationVariable.GIT_TOKEN)
100+
check_call(_generate_goreleaser_check_command_list(), cwd=SRC_DIR)
101+
102+
103+
def _call_goreleaser_release(version: str) -&gt; None:
104+
&#34;&#34;&#34;Calls go releaser release to upload packages.&#34;&#34;&#34;
105+
logger.info(&#34;Installing GoReleaser if missing.&#34;)
106+
check_call(_install_goreleaser_command_list())
107+
logger.info(&#34;Release package.&#34;)
108+
changelogPath = configuration.get_value(ConfigurationVariable.CHANGELOG_FILE_PATH)
109+
env = os.environ
110+
env[ENVVAR_GORELEASER_CUSTOMISED_TAG] = version
111+
env[ENVVAR_GORELEASER_GIT_TOKEN] = configuration.get_value(ConfigurationVariable.GIT_TOKEN)
112+
check_call(_generate_goreleaser_release_command_list(changelogPath), cwd=SRC_DIR, env=env)
113+
47114

48115
class Go(BaseLanguage):
49116
&#34;&#34;&#34;Specific actions for a Golang project.&#34;&#34;&#34;
@@ -52,22 +119,30 @@ <h1 class="title">Module <code>continuous_delivery_scripts.plugins.golang</code>
52119
&#34;&#34;&#34;Gets the related language.&#34;&#34;&#34;
53120
return get_language_from_file_name(__file__)
54121

55-
def package_software(self) -&gt; None:
122+
def get_version_tag(self, version: str):
123+
&#34;&#34;&#34;Gets tag based on version.&#34;&#34;&#34;
124+
cleansed_version = version.strip().lstrip(&#34;v&#34;)
125+
return f&#34;v{cleansed_version}&#34;
126+
127+
def package_software(self, version: str) -&gt; None:
56128
&#34;&#34;&#34;No operation.&#34;&#34;&#34;
57-
super().package_software()
129+
super().package_software(version)
130+
_call_goreleaser_check(version)
58131

59-
def release_package_to_repository(self) -&gt; None:
132+
def release_package_to_repository(self, version: str) -&gt; None:
60133
&#34;&#34;&#34;No operation.&#34;&#34;&#34;
61-
super().release_package_to_repository()
134+
super().release_package_to_repository(version)
135+
_call_goreleaser_release(version)
62136

63137
def check_credentials(self) -&gt; None:
64138
&#34;&#34;&#34;Checks any credentials.&#34;&#34;&#34;
65139
super().check_credentials()
140+
configuration.get_value(ConfigurationVariable.GIT_TOKEN)
66141

67142
def generate_code_documentation(self, output_directory: Path, module_to_document: str) -&gt; None:
68143
&#34;&#34;&#34;Generates the code documentation.&#34;&#34;&#34;
69144
super().generate_code_documentation(output_directory, module_to_document)
70-
# TODO
145+
_call_golds(output_directory, &#34;./...&#34;)
71146

72147
def can_add_licence_headers(self) -&gt; bool:
73148
&#34;&#34;&#34;States that licence headers can be added.&#34;&#34;&#34;
@@ -108,22 +183,30 @@ <h2 class="section-title" id="header-classes">Classes</h2>
108183
&#34;&#34;&#34;Gets the related language.&#34;&#34;&#34;
109184
return get_language_from_file_name(__file__)
110185

111-
def package_software(self) -&gt; None:
186+
def get_version_tag(self, version: str):
187+
&#34;&#34;&#34;Gets tag based on version.&#34;&#34;&#34;
188+
cleansed_version = version.strip().lstrip(&#34;v&#34;)
189+
return f&#34;v{cleansed_version}&#34;
190+
191+
def package_software(self, version: str) -&gt; None:
112192
&#34;&#34;&#34;No operation.&#34;&#34;&#34;
113-
super().package_software()
193+
super().package_software(version)
194+
_call_goreleaser_check(version)
114195

115-
def release_package_to_repository(self) -&gt; None:
196+
def release_package_to_repository(self, version: str) -&gt; None:
116197
&#34;&#34;&#34;No operation.&#34;&#34;&#34;
117-
super().release_package_to_repository()
198+
super().release_package_to_repository(version)
199+
_call_goreleaser_release(version)
118200

119201
def check_credentials(self) -&gt; None:
120202
&#34;&#34;&#34;Checks any credentials.&#34;&#34;&#34;
121203
super().check_credentials()
204+
configuration.get_value(ConfigurationVariable.GIT_TOKEN)
122205

123206
def generate_code_documentation(self, output_directory: Path, module_to_document: str) -&gt; None:
124207
&#34;&#34;&#34;Generates the code documentation.&#34;&#34;&#34;
125208
super().generate_code_documentation(output_directory, module_to_document)
126-
# TODO
209+
_call_golds(output_directory, &#34;./...&#34;)
127210

128211
def can_add_licence_headers(self) -&gt; bool:
129212
&#34;&#34;&#34;States that licence headers can be added.&#34;&#34;&#34;
@@ -170,7 +253,8 @@ <h3>Methods</h3>
170253
</summary>
171254
<pre><code class="python">def check_credentials(self) -&gt; None:
172255
&#34;&#34;&#34;Checks any credentials.&#34;&#34;&#34;
173-
super().check_credentials()</code></pre>
256+
super().check_credentials()
257+
configuration.get_value(ConfigurationVariable.GIT_TOKEN)</code></pre>
174258
</details>
175259
</dd>
176260
<dt id="continuous_delivery_scripts.plugins.golang.Go.get_current_spdx_project"><code class="name flex">
@@ -202,32 +286,49 @@ <h3>Methods</h3>
202286
return get_language_from_file_name(__file__)</code></pre>
203287
</details>
204288
</dd>
289+
<dt id="continuous_delivery_scripts.plugins.golang.Go.get_version_tag"><code class="name flex">
290+
<span>def <span class="ident">get_version_tag</span></span>(<span>self, version: str)</span>
291+
</code></dt>
292+
<dd>
293+
<div class="desc"><p>Gets tag based on version.</p></div>
294+
<details class="source">
295+
<summary>
296+
<span>Expand source code</span>
297+
</summary>
298+
<pre><code class="python">def get_version_tag(self, version: str):
299+
&#34;&#34;&#34;Gets tag based on version.&#34;&#34;&#34;
300+
cleansed_version = version.strip().lstrip(&#34;v&#34;)
301+
return f&#34;v{cleansed_version}&#34;</code></pre>
302+
</details>
303+
</dd>
205304
<dt id="continuous_delivery_scripts.plugins.golang.Go.package_software"><code class="name flex">
206-
<span>def <span class="ident">package_software</span></span>(<span>self) ‑> NoneType</span>
305+
<span>def <span class="ident">package_software</span></span>(<span>self, version: str) ‑> NoneType</span>
207306
</code></dt>
208307
<dd>
209308
<div class="desc"><p>No operation.</p></div>
210309
<details class="source">
211310
<summary>
212311
<span>Expand source code</span>
213312
</summary>
214-
<pre><code class="python">def package_software(self) -&gt; None:
313+
<pre><code class="python">def package_software(self, version: str) -&gt; None:
215314
&#34;&#34;&#34;No operation.&#34;&#34;&#34;
216-
super().package_software()</code></pre>
315+
super().package_software(version)
316+
_call_goreleaser_check(version)</code></pre>
217317
</details>
218318
</dd>
219319
<dt id="continuous_delivery_scripts.plugins.golang.Go.release_package_to_repository"><code class="name flex">
220-
<span>def <span class="ident">release_package_to_repository</span></span>(<span>self) ‑> NoneType</span>
320+
<span>def <span class="ident">release_package_to_repository</span></span>(<span>self, version: str) ‑> NoneType</span>
221321
</code></dt>
222322
<dd>
223323
<div class="desc"><p>No operation.</p></div>
224324
<details class="source">
225325
<summary>
226326
<span>Expand source code</span>
227327
</summary>
228-
<pre><code class="python">def release_package_to_repository(self) -&gt; None:
328+
<pre><code class="python">def release_package_to_repository(self, version: str) -&gt; None:
229329
&#34;&#34;&#34;No operation.&#34;&#34;&#34;
230-
super().release_package_to_repository()</code></pre>
330+
super().release_package_to_repository(version)
331+
_call_goreleaser_release(version)</code></pre>
231332
</details>
232333
</dd>
233334
</dl>
@@ -265,6 +366,7 @@ <h4><code><a title="continuous_delivery_scripts.plugins.golang.Go" href="#contin
265366
<li><code><a title="continuous_delivery_scripts.plugins.golang.Go.check_credentials" href="#continuous_delivery_scripts.plugins.golang.Go.check_credentials">check_credentials</a></code></li>
266367
<li><code><a title="continuous_delivery_scripts.plugins.golang.Go.get_current_spdx_project" href="#continuous_delivery_scripts.plugins.golang.Go.get_current_spdx_project">get_current_spdx_project</a></code></li>
267368
<li><code><a title="continuous_delivery_scripts.plugins.golang.Go.get_related_language" href="#continuous_delivery_scripts.plugins.golang.Go.get_related_language">get_related_language</a></code></li>
369+
<li><code><a title="continuous_delivery_scripts.plugins.golang.Go.get_version_tag" href="#continuous_delivery_scripts.plugins.golang.Go.get_version_tag">get_version_tag</a></code></li>
268370
<li><code><a title="continuous_delivery_scripts.plugins.golang.Go.package_software" href="#continuous_delivery_scripts.plugins.golang.Go.package_software">package_software</a></code></li>
269371
<li><code><a title="continuous_delivery_scripts.plugins.golang.Go.release_package_to_repository" href="#continuous_delivery_scripts.plugins.golang.Go.release_package_to_repository">release_package_to_repository</a></code></li>
270372
</ul>

0 commit comments

Comments
 (0)