[VOL-5296] shellcheck and yamllint cleanups
jjb/shell/github-release.sh
---------------------------
o Cleanup shellcheck warnings prior to working on voltctl error.
jjb/docker-publish.yaml
-----------------------
o repo: ci-management requires a yaml config edit in order for a job
to run so arbitrarily modify docker-publish.yaml.
o Cleanup yamllint warnings about long lines.
[HOWTO: test]
% make lint-shell
shellcheck jjb/shell/github-release.sh
% make lint-yaml-all
yamllint --strict jjb/docker-publish.yaml
Change-Id: If367e80da7c2e12c2025769eca716e439d6396ee
diff --git a/jjb/docker-publish.yaml b/jjb/docker-publish.yaml
index 4706c45..ad09132 100644
--- a/jjb/docker-publish.yaml
+++ b/jjb/docker-publish.yaml
@@ -1,11 +1,32 @@
---
-# generic docker image building + dockerhub publishing tasks
+
+# -----------------------------------------------------------------------
+# Copyright 2019-2024 Open Networking Foundation Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+# SPDX-FileCopyrightText: 2019-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent: Generic docker image building + dockerhub publishing tasks
+# -----------------------------------------------------------------------
- job-template:
id: docker-publish
name: 'docker-publish_{project}'
- description: |
- Created by {id} job-template from ci-management/jjb/docker-publish.yaml, script pipeline/docker-publish.groovy
+ description: >+
+ Created by {id} job-template from ci-management/jjb/docker-publish.yaml,
+ script pipeline/docker-publish.groovy
triggers:
- cord-infra-gerrit-trigger-merge:
@@ -54,18 +75,22 @@
- string:
name: dockerRepo
default: '{docker-repo}'
- description: "Docker repository to push to ('opencord', 'xosproject', etc.)"
+ description: >
+ "Docker repository to push to ('opencord', 'xosproject', etc.)"
- string:
name: dockerRegistry
default: '{docker-registry}'
description: "Docker registry to push to (blank for DockerHub)"
- # AWS CPU arch names: `x86_64` `arm64` (which don't align to vendor names... *sigh*)
+ # AWS CPU arch names: `x86_64` `arm64`
+ # (which don't align to vendor names... *sigh*)
- string:
name: dockerArchList
default: 'x86_64'
- description: "List of architectures to build containers on, pipe separated (nonfunctional currently)"
+ description: >
+ "List of architectures to build containers on, pipe separated
+ (nonfunctional currently)"
- string:
name: maintainers
diff --git a/jjb/shell/github-release.sh b/jjb/shell/github-release.sh
index 050f37e..40307e8 100755
--- a/jjb/shell/github-release.sh
+++ b/jjb/shell/github-release.sh
@@ -17,7 +17,7 @@
# SPDX-FileCopyrightText: 2018-2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
-# github-release.sh
+# Intent:
# builds (with make) and uploads release artifacts (binaries, etc.) to github
# given a tag also create checksums files and release notes from the commit
# message
@@ -123,7 +123,7 @@
## -----------------------------------------------------------------------
function get_version()
{
- declare -n ref="$1"
+ local -n ref="$1"
declare -a rev=()
rev+=("$(( RANDOM % 10 + 1 ))")
@@ -267,7 +267,7 @@
## -----------------------------------------------------------------------
function getGitVersion()
{
- declare -n varname="$1"; shift
+ local -n varname="$1"; shift
local __ver # use prefix('__') to protect callers variable name
if [[ -v cached_getGitVersion ]]; then
@@ -334,7 +334,7 @@
## -----------------------------------------------------------------------
function getReleaseDescription()
{
- declare -n varname="$1"; shift
+ local -n varname="$1"; shift
local msg
msg="$(git log -1 --pretty=%B)"
@@ -354,7 +354,7 @@
## -----------------------------------------------------------------------
function get_release_dir()
{
- declare -n varname=$1; shift
+ local -n varname=$1; shift
# Temporary staging directory to copy artifacts to
varname="$scratch/release"
@@ -367,7 +367,7 @@
## -----------------------------------------------------------------------
function get_gh_hostname()
{
- declare -n varname=$1; shift
+ local -n varname=$1; shift
varname+=('--hostname' "${__githost}")
return
}
@@ -377,7 +377,7 @@
## -----------------------------------------------------------------------
function get_gh_repo_org()
{
- declare -n ref=$1; shift
+ local -n ref=$1; shift
declare -g __repo_org
local org
@@ -398,7 +398,7 @@
## -----------------------------------------------------------------------
function get_gh_repo_name()
{
- declare -n ref=$1; shift
+ local -n ref=$1; shift
declare -g __repo_name
local name
@@ -419,7 +419,7 @@
## -----------------------------------------------------------------------
function get_gh_releases()
{
- declare -n ref="$1"
+ local -n ref="$1"
local repo_org
get_gh_repo_org repo_org
@@ -437,7 +437,7 @@
## -----------------------------------------------------------------------
function get_argv_repo()
{
- declare -n ref=$1; shift
+ local -n ref=$1; shift
local repo_org
get_gh_repo_org repo_org
@@ -455,7 +455,7 @@
## -----------------------------------------------------------------------
function get_argv_name()
{
- declare -n ref=$1; shift
+ local -n ref=$1; shift
local repo_name
get_gh_repo_name repo_name
@@ -474,7 +474,7 @@
## -----------------------------------------------------------------------
function get_argv_tag()
{
- declare -n ref=$1; shift
+ local -n ref=$1; shift
# cached_argv_tag='v3.41.3204'
if [[ ! -v cached_argv_tag ]]; then
@@ -502,7 +502,7 @@
## -----------------------------------------------------------------------
function get_release_path()
{
- declare -n ref=$1; shift
+ local -n ref=$1; shift
# shellcheck disable=SC2128
local varpath="$ref"
@@ -570,7 +570,8 @@
function get_artifacts()
{
local dir="$1" ; shift
- declare -n refA=$1 ; shift
+ # shellcheck disable=SC2178
+ local -n refA=$1 ; shift
# Glob available files, exclude checksums
readarray -t __artifacts < <(find "$dir" -mindepth 1 ! -type d \
@@ -758,7 +759,8 @@
## -----------------------------------------------------------------------
function get_releases()
{
- declare -n refA="$1"; shift
+ # shellcheck disable=SC2178
+ local -n refA="$1"; shift
banner ""
pushd "$scratch" >/dev/null
@@ -853,7 +855,8 @@
## -----------------------------------------------------------------------
function releaseDelete()
{
- declare -n refA=$1; shift
+ # shellcheck disable=SC2178
+ local -n refA=$1; shift
local version="$1"; shift
banner "${refA[@]}"
@@ -926,7 +929,7 @@
## o Command wrapper can provide defaults (--hostname github.com)
## -----------------------------------------------------------------------
## Given:
-## scalar Array variable name (declare -n is a reference)
+## scalar Array variable name (local -n is a reference)
## Return:
## ref gh command line passed back to caller
## Switches: