Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up via shellcheck, shfmt, and markdownlint #1862

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions components/builder-minio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

This plans implements `builder-minio` - **AWS S3** compatible storage for the **Habitat Builder**.

# Configuration
## Configuration

All important configuration is described in the `habitat/default.toml` file and it is good practice.

# Versioning
## Versioning

Each commit produces increment version number which is good approach for the *Continues Integration*.


7 changes: 4 additions & 3 deletions components/builder-minio/habitat/config/hook-helper.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- mode: shell-script -*-
# shellcheck shell=bash
#!/bin/bash

# shellcheck disable=SC2140
# {{#each cfg.env}}
Expand All @@ -25,9 +24,11 @@ fi
export AWS_ACCESS_KEY_ID="$MINIO_ACCESS_KEY"
export AWS_SECRET_ACCESS_KEY="$MINIO_SECRET_KEY"

# shellcheck disable=SC2034
MEMBERS='{{#if cfg.members }}{{strJoin cfg.members " "}}{{else}}{{pkg.svc_data_path}}{{/if}}'
BUCKET_NAME="{{cfg.bucket_name}}"

# shellcheck disable=SC2034
BIND_ADDRESS="{{cfg.bind_address}}"
BIND_PORT="{{cfg.bind_port}}"

Expand All @@ -39,7 +40,7 @@ create_bucket() {
aws_s3="aws --endpoint-url http://localhost:$BIND_PORT s3api"
fi

if $aws_s3 list-buckets | grep "$BUCKET_NAME" > /dev/null; then
if $aws_s3 list-buckets | grep "$BUCKET_NAME" >/dev/null; then
echo "Minio bucket is up to date."
else
echo "Creating minio bucket $BUCKET_NAME."
Expand Down
4 changes: 2 additions & 2 deletions components/builder-minio/habitat/hooks/post-run
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- mode: shell-script -*-
# shellcheck shell=bash
#!/bin/bash

set -e

exec 2>&1

# shellcheck disable=SC1091
. "{{ pkg.svc_config_path }}/hook-helper.sh"

# post-run is much faster than minio
Expand Down
2 changes: 1 addition & 1 deletion components/builder-minio/habitat/hooks/reconfigure
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
# shellcheck disable=2154

set -e

exec 2>&1

# shellcheck disable=SC1091
. "{{ pkg.svc_config_path }}/hook-helper.sh"

create_bucket
4 changes: 2 additions & 2 deletions components/builder-minio/habitat/hooks/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- mode: shell-script -*-
# shellcheck shell=bash
#!/bin/bash

# When run hook changes restart is happen.
# Any change to the environment variables requires restart:
Expand All @@ -13,6 +12,7 @@

exec 2>&1

# shellcheck disable=SC1091
. "{{ pkg.svc_config_path }}/hook-helper.sh"

# shellcheck disable=SC2086,SC2154
Expand Down
21 changes: 10 additions & 11 deletions components/builder-minio/habitat/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ pkg_deps=(core/aws-cli core/bash core/cacerts core/curl core/jq-static core/mini
pkg_build_deps=(core/git)

pkg_exports=(
[port]=bind_port
[bucket-name]=bucket_name
[minio-access-key]=env.MINIO_ACCESS_KEY
[minio-secret-key]=env.MINIO_SECRET_KEY
[port]=bind_port
[bucket-name]=bucket_name
[minio-access-key]=env.MINIO_ACCESS_KEY
[minio-secret-key]=env.MINIO_SECRET_KEY
)

pkg_version() {
# TED: After migrating the builder repo we needed to add to
# the rev-count to keep version sorting working
# echo "$(($(git rev-list HEAD --count) + 5000))"
echo "$(($(git rev-list HEAD --count) + 5001))"
echo "$(($(git rev-list HEAD --count) + 5000))"
}

do_before() {
Expand All @@ -27,17 +26,17 @@ do_before() {
}

do_unpack() {
return 0
return 0
}

do_build(){
return 0
do_build() {
return 0
}

do_install() {
return 0
return 0
}

do_strip() {
return 0
return 0
}
Loading