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

Extract bundle fluentd plugins function #946

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

pmalek-sumo
Copy link
Contributor

Testing performed
  • ci/build.sh
  • Redeploy fluentd and fluentd-events pods
  • Confirm events, logs, and metrics are coming in

@pmalek-sumo pmalek-sumo merged commit b20fe38 into master Sep 24, 2020
@pmalek-sumo pmalek-sumo deleted the extract_bundle_fluentd_plugins_bash_function branch September 24, 2020 10:51
Copy link
Contributor

@perk-sumo perk-sumo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nitpicks. Let me create another PR with them.

@@ -18,6 +18,39 @@ function get_branch_to_checkout() {
|| echo "${TRAVIS_BRANCH}"
}

function bundle_fluentd_plugins() {
local VERSION="${1}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change the VERSION variable into version to indicate it's a local one.

Suggested change
local VERSION="${1}"
local version="${1}"

function bundle_fluentd_plugins() {
local VERSION="${1}"

if [[ "${VERSION}" == "" ]] ; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could also use local VERSION="${1:?}" above to check if the variable is set but I like the explicit error in here 👍

if [[ -d "${i}" ]]; then
(
cd "${i}" || exit 1
PLUGIN_NAME="$(basename "${i}")"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PLUGIN_NAME="$(basename "${i}")"
local plugin_name="$(basename "${i}")"

cd "${i}" || exit 1
PLUGIN_NAME="$(basename "${i}")"
# Strip everything after "-" (longest match) to avoid gem prerelease behavior
GEM_VERSION="${VERSION%%-*}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GEM_VERSION="${VERSION%%-*}"
local gem_version="${version%%-*}"

function bundle_fluentd_plugins() {
local VERSION="${1}"

if [[ "${VERSION}" == "" ]] ; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [[ "${VERSION}" == "" ]] ; then
if [[ "${version}" == "" ]] ; then

Comment on lines +36 to +38
echo "Building gem ${PLUGIN_NAME} version ${GEM_VERSION} in $(pwd) ..."
sed -i.bak "s/0.0.0/${GEM_VERSION}/g" ./"${PLUGIN_NAME}".gemspec
rm -f ./"${PLUGIN_NAME}".gemspec.bak
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Building gem ${PLUGIN_NAME} version ${GEM_VERSION} in $(pwd) ..."
sed -i.bak "s/0.0.0/${GEM_VERSION}/g" ./"${PLUGIN_NAME}".gemspec
rm -f ./"${PLUGIN_NAME}".gemspec.bak
echo "Building gem ${plugin_name} version ${gem_version} in $(pwd) ..."
sed -i.bak "s/0.0.0/${gem_version}/g" ./"${plugin_name}".gemspec
rm -f ./"${plugin_Name}".gemspec.bak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants