Skip to content

Allow setting Dashboard image tag during Capact release#617

Merged
pkosiec merged 6 commits intocapactio:mainfrom
pkosiec:update-release-for-06
Jan 26, 2022
Merged

Allow setting Dashboard image tag during Capact release#617
pkosiec merged 6 commits intocapactio:mainfrom
pkosiec:update-release-for-06

Conversation

@pkosiec
Copy link
Copy Markdown
Collaborator

@pkosiec pkosiec commented Jan 26, 2022

Description

Changes proposed in this pull request:

  • Allow setting Dashboard image tag during Capact release
  • Refactor make-release.sh script to use yq (as previous approach with sed was error prone)

Testing

Sample run: https://github.com/pkosiec/capact/actions/runs/1751316086

(I commented unnecessary steps: pkosiec@71cc872)

Results:

Related issue(s)

#600

@pkosiec pkosiec added enhancement New feature or request area/ci Relates to CI labels Jan 26, 2022
@pkosiec pkosiec added this to the 0.6.0 milestone Jan 26, 2022
Copy link
Copy Markdown
Collaborator

@mszostok mszostok left a comment

Choose a reason for hiding this comment

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

I tested that and overall it works, but the only thing that I don't like about it is that it breaks our formatting: mikefarah/yq#465 and produces less readable vaules.yaml files.

Personally, I'm not sure whether this change is really needed. The current solution worked IMO better. I know that it was error-prone, but this is not a user facing script.

Maybe we should just have our own tool to replace proper things in our manifests.

Comment thread hack/make-release.sh Outdated
@pkosiec pkosiec force-pushed the update-release-for-06 branch from 324fb08 to 92d90c7 Compare January 26, 2022 15:45
@pkosiec
Copy link
Copy Markdown
Collaborator Author

pkosiec commented Jan 26, 2022

While I understand that yq reformats yamls removing e.g. blank lines, it still keep comments and other values, which doesn't seem to me as a huge downside. So I have to disagree with

The current solution worked IMO better. I know that it was error-prone, but this is not a user facing script.

The current solution is very shortsighted. In case of Dashboard tag, it forces me to replace any tag property, which is a generic word. It's a matter of time when we have such duplicated property in the values.yaml file. Same with other properties, like branch, which could occur multiple times, as we have multiple sources support in Populator. Should we build more complex sed one-liners in future? Definitely not.

Maybe we should just have our own tool to replace proper things in our manifests.

And this sounds like an overkill for me, but of course you can contribute with such solution 🙂 I backed off with the yq refactor (reverted modifications in two files) to end discussion, as I need the new functionality for upcoming release.

So, here are examples after changes:

(After that I fixed linter issues, but I also tested the script locally, it works the same).

Copy link
Copy Markdown
Collaborator

@mszostok mszostok left a comment

Choose a reason for hiding this comment

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

I totally get your concerns and I'm not against fixing that at all 👍
But I think that it will be good to just log an issue for it instead of doing that here. We should aim for a solution which will solves the problem that you described but also preserve current good formatting approach 👍

And this sounds like an overkill for me,

I was referring to rewriting bash to Go which IMO is not so overkill at all as we are quite fluent in Go. Having:

# DASHBOARD_IMAGE_TAG - Dashboard image tag used for a given release
[[ ( -z "${DASHBOARD_IMAGE_TAG}" || "${DASHBOARD_IMAGE_TAG}" == PR-* ) ]] && echo "Need to set DASHBOARD_IMAGE_TAG that doesn't start with 'PR-' prefix" && exit 1;

SOURCE_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
RELEASE_VERSION_MAJOR_MINOR="$(echo "${RELEASE_VERSION}" | sed -E 's/([0-9]+\.[0-9])\.[0-9]/\1/g')"
RELEASE_BRANCH="release-${RELEASE_VERSION_MAJOR_MINOR}"

is definitely not our thing.

And this sounds like an overkill for me, but of course you can contribute with such solution 🙂

As mentioned, we can log an issue for that.

Regarding mikefarah/yq#465, it was not working like that previously, so definitely there will be a solution for that.

TL;DR;
I'm totally not against improvements, and you spot a real problem but let's not do them in a rush where we solve one problem but introduce another one. If you can, please create a ticket for it, so we can come up with a solution and introduce it also in all repos at once. As we all known "consistent code is easier to maintain, and requires less cognitive overhead."

BTW previous solution was also approved, but as you revert it I also approve this one 👍

@pkosiec pkosiec merged commit c28f0be into capactio:main Jan 26, 2022
@pkosiec pkosiec deleted the update-release-for-06 branch January 26, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci Relates to CI enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants