Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
electrocucaracha committed Dec 26, 2024
1 parent 87f4f88 commit 15de3d9
Show file tree
Hide file tree
Showing 19 changed files with 339 additions and 330 deletions.
3 changes: 0 additions & 3 deletions .editorconfig

This file was deleted.

1 change: 1 addition & 0 deletions .github/actions/vagrant-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
name: Vagrant setup
description: Configures the Vagrant requirements
inputs:
distro:
description: Linux distribution
Expand Down
1 change: 1 addition & 0 deletions .github/actions/vagrant-up/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
name: Vagrant up
description: Creates a Vagrant Virtual Machine
inputs:
memory:
description: "Memory"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/diagram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- codebase-structure.svg
- .github/
workflow_dispatch:
permissions: read-all
jobs:
check-diagram:
name: Update the codebase structure diagram
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/distros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
permissions: read-all
jobs:
check-versions:
runs-on: vm-self-hosted
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ name: Lint Code Base
on:
push:
pull_request:
permissions: read-all
jobs:
get-sloc:
name: Count Lines of Code
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on-demand_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
types:
- submitted
workflow_dispatch:
permissions: read-all
jobs:
changes:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ name: Automatic Rebase
on:
issue_comment:
types: [created]
permissions: read-all
jobs:
rebase:
name: Rebase
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scheduled_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
schedule:
- cron: "0 0 * * 5"
workflow_dispatch:
permissions: read-all
jobs:
check-ubuntu-jammy-baremetal:
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/spell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
pull_request_review:
types:
- submitted
permissions: read-all
jobs:
check-reviewdog:
name: Check spelling (reviewdog)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
schedule:
- cron: "0 0 * * 5"
workflow_dispatch:
permissions: read-all
jobs:
check-versions:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lint:
sudo -E $(DOCKER_CMD) run --rm -v $$(pwd):/tmp/lint \
-e RUN_LOCAL=true \
-e LINTER_RULES_PATH=/ \
github/super-linter
ghcr.io/super-linter/super-linter
tox -e lint

.PHONY: fmt
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ coding, documenting, testing, spreading the word at events within others.
Thanks to all the people who already contributed!

<a href="https://github.com/electrocucaracha/bootstrap-vagrant/graphs/contributors">
<img src="https://contrib.rocks/image?repo=electrocucaracha/bootstrap-vagrant" />
<img src="https://contrib.rocks/image?repo=electrocucaracha/bootstrap-vagrant" alt="Contributors" />
</a>

![Visualization of the codebase](./codebase-structure.svg)
Expand Down
10 changes: 5 additions & 5 deletions build/ci/run_task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ set -o nounset
set -o xtrace

if ! command -v fly; then
# NOTE: Shorten link -> https://github.com/electrocucaracha/pkg-mgr_scripts
curl -fsSL http://bit.ly/install_pkg | PKG=fly bash
# NOTE: Shorten link -> https://github.com/electrocucaracha/pkg-mgr_scripts
curl -fsSL http://bit.ly/install_pkg | PKG=fly bash
fi

fly execute --privileged \
--target="${RELENG_TARGET:-releng}" \
--config="${TASK_NAME}-task.yml" \
-i src=../../ "$@"
--target="${RELENG_TARGET:-releng}" \
--config="${TASK_NAME}-task.yml" \
-i src=../../ "$@"
80 changes: 40 additions & 40 deletions ci/update_distros.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,63 +11,63 @@
set -o errexit
set -o pipefail
if [[ ${KRD_DEBUG:-false} == "true" ]]; then
set -o xtrace
set -o xtrace
fi

PROVIDER=${PROVIDER:-virtualbox}
msg=""

function _get_box_version {
local version=""
local attempt_counter=0
readonly max_attempts=5
readonly name="$1"
local version=""
local attempt_counter=0
readonly max_attempts=5
readonly name="$1"

if [ -f ./ci/pinned_vagrant_boxes.txt ] && grep -q "^${name} .*$PROVIDER" ./ci/pinned_vagrant_boxes.txt; then
version=$(grep "^${name} .*$PROVIDER" ./ci/pinned_vagrant_boxes.txt | awk '{ print $2 }')
else
until [ "$version" ]; do
metadata="$(curl -s "https://app.vagrantup.com/api/v1/box/$name")"
if [ "$metadata" ]; then
version="$(echo "$metadata" | python -c 'import json,sys;print(json.load(sys.stdin)["current_version"]["version"])')"
break
elif [ ${attempt_counter} -eq ${max_attempts} ]; then
echo "Max attempts reached"
exit 1
fi
attempt_counter=$((attempt_counter + 1))
sleep $((attempt_counter * 2))
done
fi
if [ -f ./ci/pinned_vagrant_boxes.txt ] && grep -q "^${name} .*$PROVIDER" ./ci/pinned_vagrant_boxes.txt; then
version=$(grep "^${name} .*$PROVIDER" ./ci/pinned_vagrant_boxes.txt | awk '{ print $2 }')
else
until [ "$version" ]; do
metadata="$(curl -s "https://app.vagrantup.com/api/v1/box/$name")"
if [ "$metadata" ]; then
version="$(echo "$metadata" | python -c 'import json,sys;print(json.load(sys.stdin)["current_version"]["version"])')"
break
elif [ ${attempt_counter} -eq ${max_attempts} ]; then
echo "Max attempts reached"
exit 1
fi
attempt_counter=$((attempt_counter + 1))
sleep $((attempt_counter * 2))
done
fi

echo "${version#*v}"
echo "${version#*v}"
}

function _vagrant_pull {
local alias="$1"
local name="$2"
local alias="$1"
local name="$2"

version=$(_get_box_version "$name")
version=$(_get_box_version "$name")

if [ "$(curl "https://app.vagrantup.com/${name%/*}/boxes/${name#*/}/versions/$version/providers/$PROVIDER.box" -o /dev/null -w '%{http_code}\n' -s)" == "302" ] && [ "$(vagrant box list | grep -c "$name .*$PROVIDER, $version")" != "1" ]; then
vagrant box remove --provider "$PROVIDER" --all --force "$name" || :
vagrant box add --provider "$PROVIDER" --box-version "$version" "$name"
elif [ "$(vagrant box list | grep -c "$name .*$PROVIDER, $version")" == "1" ]; then
echo "$name($version, $PROVIDER) box is already present in the host"
else
msg+="$name($version, $PROVIDER) box doesn't exist\n"
return
fi
cat <<EOT >>.distros_supported.yml
if [ "$(curl "https://app.vagrantup.com/${name%/*}/boxes/${name#*/}/versions/$version/providers/$PROVIDER.box" -o /dev/null -w '%{http_code}\n' -s)" == "302" ] && [ "$(vagrant box list | grep -c "$name .*$PROVIDER, $version")" != "1" ]; then
vagrant box remove --provider "$PROVIDER" --all --force "$name" || :
vagrant box add --provider "$PROVIDER" --box-version "$version" "$name"
elif [ "$(vagrant box list | grep -c "$name .*$PROVIDER, $version")" == "1" ]; then
echo "$name($version, $PROVIDER) box is already present in the host"
else
msg+="$name($version, $PROVIDER) box doesn't exist\n"
return
fi
cat <<EOT >>.distros_supported.yml
- alias: $alias
name: $name
version: "$version"
EOT
}

if ! command -v vagrant >/dev/null; then
# NOTE: Shorten link -> https://github.com/electrocucaracha/bootstrap-vagrant
curl -fsSL http://bit.ly/initVagrant | bash
# NOTE: Shorten link -> https://github.com/electrocucaracha/bootstrap-vagrant
curl -fsSL http://bit.ly/initVagrant | bash
fi

cat <<EOT >.distros_supported.yml
Expand All @@ -91,8 +91,8 @@ _vagrant_pull "opensuse_tumbleweed" "opensuse/Tumbleweed.x86_64"
_vagrant_pull "opensuse_leap" "opensuse/Leap-15.2.x86_64"

if [ "$msg" ]; then
echo -e "$msg"
rm .distros_supported.yml
echo -e "$msg"
rm .distros_supported.yml
else
mv .distros_supported.yml distros_supported.yml
mv .distros_supported.yml distros_supported.yml
fi
8 changes: 4 additions & 4 deletions ci/update_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
set -o errexit
set -o pipefail
if [[ ${DEBUG:-false} == "true" ]]; then
set -o xtrace
set -o xtrace
fi

eval "$(curl -fsSL https://raw.githubusercontent.com/electrocucaracha/pkg-mgr_scripts/master/ci/pinned_versions.env)"
Expand All @@ -22,8 +22,8 @@ sed -i "s/vagrant version.*/vagrant version | awk 'NR==1\{print \$3}')\" != \"$P
# Update GitHub Action commit hashes
gh_actions=$(grep -r "uses: [a-zA-Z\-]*/[\_a-z\-]*@" .github/ | sed 's/@.*//' | awk -F ': ' '{ print $3 }' | sort -u)
for action in $gh_actions; do
commit_hash=$(git ls-remote "https://github.com/$action" | grep 'refs/tags/[v]\?[0-9][0-9\.]*$' | sed 's|refs/tags/[vV]\?[\.]\?||g' | sort -u -k2 -V | tail -1 | awk '{ printf "%s # %s\n",$1,$2 }')
# shellcheck disable=SC2267
grep -ElRZ "uses: $action@" .github/ | xargs -0 -l sed -i -e "s|uses: $action@.*|uses: $action@$commit_hash|g"
commit_hash=$(git ls-remote "https://github.com/$action" | grep 'refs/tags/[v]\?[0-9][0-9\.]*$' | sed 's|refs/tags/[vV]\?[\.]\?||g' | sort -u -k2 -V | tail -1 | awk '{ printf "%s # %s\n",$1,$2 }')
# shellcheck disable=SC2267
grep -ElRZ "uses: $action@" .github/ | xargs -0 -l sed -i -e "s|uses: $action@.*|uses: $action@$commit_hash|g"
done
make fmt
Loading

0 comments on commit 15de3d9

Please sign in to comment.