From 20f5185a8c5f918b71f929d4d642185b0d4fa099 Mon Sep 17 00:00:00 2001 From: Cameron Perera Date: Thu, 12 May 2022 09:32:39 -0500 Subject: [PATCH] chore: Change how update-ui-version gets the latest commit sha (#2069) * chore: Change how update-ui-version gets the latest commit sha on main * remove changelog edits * chore: refactor uiupdate.sh to use UI_COMMITISH instead of main --- Makefile | 2 +- scripts/uiupdate.sh | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index c4bd3d0cc..3229a1973 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ update-ui-version: else \ echo "==> Setting to latest commit matching '$(UI_COMMITISH)'"; \ fi; \ - ./scripts/uiclone.sh && ./scripts/uiupdate.sh + ./scripts/uiupdate.sh .PHONY: build-ui build-ui: diff --git a/scripts/uiupdate.sh b/scripts/uiupdate.sh index 3e9bd9ae7..0e65a29bd 100755 --- a/scripts/uiupdate.sh +++ b/scripts/uiupdate.sh @@ -1,22 +1,27 @@ -#!/bin/sh +#!/usr/bin/env bash set -e if [ -z "$UI_VERSION_FILE" ]; then echo "Must set UI_VERSION_FILE"; exit 1 fi -if [ -z "$UI_CLONE_DIR" ]; then - echo "Must set UI_CLONE_DIR"; exit 1 +if [ -z "$UI_COMMITISH" ]; then + echo "Must set UI_COMMITISH"; exit 1 fi shafileabs="$(pwd)/${UI_VERSION_FILE}" -cd "${UI_CLONE_DIR}" -V="$(git log -n1 --pretty=oneline)" -echo "==> Setting UI version to: $V" +V="$(git ls-remote https://github.com/hashicorp/boundary-ui ${UI_COMMITISH})" + +if [ -z "$V" ]; then + V=$UI_COMMITISH; +fi + +SHA=${V:0:40} +echo "==> Setting UI version to: $SHA" # Write the version file. { - echo "$V" + echo "$SHA" echo "# This file determines the version of the UI to embed in the boundary binary." echo "# Update this file by running 'make update-ui-version' from the root of this repo." echo "# Set UI_COMMITISH when running the above target to update to a specific version."