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

Automatically sync chart #552

Merged
merged 3 commits into from
Aug 30, 2018
Merged

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Aug 28, 2018

Fixes #414

Automatically release a chart in the repository bitnami/charts for Kubeapps. The process for updating a version is:

  1. Add a new tag for the repo (as always). This will generate all the images required for the new version.
  2. Increase the version number of the chart at chart/kubeapps/Chart.yaml. Once that change is in master CircleCI will update the status of the bitnami/charts repo with the files in this repository.

IMPORTANT: The script in 2. will automatically change the references to tag: latest in the file chart/kubeapps/values.yaml with the latest tag available (normally the tag released in 1.).

Update example: andresmgot/charts-1@d3c6918

@andresmgot andresmgot force-pushed the autoChartRelease branch 2 times, most recently from 8fae076 to 2013cb7 Compare August 28, 2018 14:33

set -e

CHARTS_REPO="andresmgot/charts-1"
Copy link
Contributor

Choose a reason for hiding this comment

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

guessing this needs to change to bitnami/charts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😅


changedVersion() {
local currentVersion=$(cat "${KUBEAPPS_CHART_DIR}/Chart.yaml" | grep "version:")
local externalVersion=$(curl -s https://raw.githubusercontent.com/${CHARTS_REPO}/master/${CHART_REPO_PATH}/Chart.yaml | grep "version:")
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we use git describe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean git describe for the external version? There are no tags there and in any case there are no tags for the version of the chart.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh sorry, I misread this line, can we use https://charts.bitnami.com/bitnami/index.yaml instead?

cp -R "${KUBEAPPS_CHART_DIR}" "${targetRepo}/${CHART_REPO_PATH}"
# DANGER: This replaces any tag marked as latest
sed -i.bk 's/tag: latest/tag: '"${targetTag}"'/g' "${targetRepo}/${CHART_REPO_PATH}/values.yaml"
rm "${targetRepo}/${CHART_REPO_PATH}/values.yaml.bk"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also set appVersion in the Chart.yaml? I'm thinking that in this repo we set Chart.yaml to "latest" or "UNRELEASED" or something. Otherwise, we'll have to bump that also when updating the chart version here. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a slightly difference (at least right now) between the appVersion in the Chart.yaml and the github tag: v1.0.0.alpha.6 vs v1.0.0-alpha.6 (note the dash). I don't know if that is intentional but that prevents from auto updating that field here if we want to follow the same notation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, that's a mistake - I didn't even realise. The appVersion should be the same as the tag.

return 1
fi
git add --all .
git commit -m "Update Kubeapps chart"
Copy link
Contributor

Choose a reason for hiding this comment

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

We should set this to "kubeapps: bump chart version to $VERSION" to match the bitnami-bot commit messages: https://github.com/bitnami/charts/commits/master

function commit_list {
local tag=${1:?}
local repo_domain=${2:?}
local repo_name=${3:?}
git fetch --tags
local previous_tag=`git describe --tags $(git rev-list --tags --max-count=1)`
local previous_tag=$(getLatestTag)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is getLatestTag the previous tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mm, you are right. I thought that when the current commit is a tag this would return the previous one but I just checked in the latest release of circleCI and it's returning the current tag (so the comparison is empty). Did this work when you did the release of v1.0.0-alpha.6? I see you discarded the draft and you created the release notes on your own, did the draft include the list of commits of the release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it seems it doesn't work. I'll send a PR for fixing that.

Copy link
Contributor

Choose a reason for hiding this comment

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

It didn't, I forgot to create an issue for it, sorry - thanks!

.circleci/config.yml Show resolved Hide resolved
Copy link
Contributor

@prydonius prydonius left a comment

Choose a reason for hiding this comment

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

lgtm but let's set the appVersion in Chart.yaml too

@andresmgot andresmgot merged commit 17c32d1 into vmware-tanzu:master Aug 30, 2018
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.

2 participants