Skip to content

Commit

Permalink
Avoid double v prefix in the AppList (#2123)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Martinez Gotor committed Oct 26, 2020
1 parent e5a1bea commit 8f27769
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
16 changes: 16 additions & 0 deletions dashboard/src/components/AppList/AppListItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,19 @@ it("should add a second label with the app update available", () => {
const tooltip = wrapper.find(Tooltip);
expect(tooltip.text()).toBe("New App Version: 1.1.0");
});

it("doesn't include a double v prefix", () => {
const props = {
...defaultProps,
app: {
...defaultProps.app,
chartMetadata: {
name: "foo",
appVersion: "v1.0.0",
},
updateInfo: {},
},
} as IAppListItemProps;
const wrapper = mountWrapper(defaultStore, <AppListItem {...props} />);
expect(wrapper.find("span").findWhere(s => s.text() === "App: foo v1.0.0")).toExist();
});
4 changes: 3 additions & 1 deletion dashboard/src/components/AppList/AppListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ function AppListItem(props: IAppListItemProps) {
<div>
<span>
App: {app.chartMetadata.name}{" "}
{app.chartMetadata.appVersion ? `v${app.chartMetadata.appVersion}` : ""}
{app.chartMetadata.appVersion
? `v${app.chartMetadata.appVersion.replace(/^v/, "")}`
: ""}
</span>
<br />
<span>Chart: {app.chartMetadata.version}</span>
Expand Down
3 changes: 2 additions & 1 deletion script/chart_sync_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ replaceImage() {
updateRepo() {
local targetRepo=${1:?}
local targetTag=${2:?}
local targetTagWithoutV=${targetTag#v}
local targetChartPath="${targetRepo}/${CHART_REPO_PATH}"
local chartYaml="${targetChartPath}/Chart.yaml"
if [ ! -f "${chartYaml}" ]; then
Expand All @@ -80,7 +81,7 @@ updateRepo() {
rm -rf "${targetChartPath}"
cp -R "${KUBEAPPS_CHART_DIR}" "${targetChartPath}"
# Update Chart.yaml with new version
sed -i.bk 's/appVersion: DEVEL/appVersion: '"${targetTag}"'/g' "${chartYaml}"
sed -i.bk 's/appVersion: DEVEL/appVersion: '"${targetTagWithoutV}"'/g' "${chartYaml}"
rm "${targetChartPath}/Chart.yaml.bk"
# Replace images for the latest available
replaceImage dashboard "${targetChartPath}/values.yaml"
Expand Down

0 comments on commit 8f27769

Please sign in to comment.