Skip to content

Commit

Permalink
Hardcode repo paths for now (#117)
Browse files Browse the repository at this point in the history
- and fix up mccp path?
  • Loading branch information
foot authored Sep 23, 2021
1 parent 5f32082 commit 34bff4f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
make update-mccp-chart-values CHART_VALUES_PATH=$CHART_VALUES_PATH
# Publish the MCCP Helm v3 chart
./bin/publish-chart-to-s3.sh $TAG $GITHUB_EVENT_NAME ./charts/mccp 3
./bin/publish-chart-to-s3.sh $TAG "charts-v3" ./charts/mccp
- name: Login to Docker Hub
if: ${{ runner.os == 'Linux' }}
uses: docker/login-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
make update-mccp-chart-values CHART_VALUES_PATH=$CHART_VALUES_PATH
# Publish the MCCP Helm v3 chart
./bin/publish-chart-to-s3.sh $TAG $GITHUB_EVENT_NAME ./charts/mccp 3
./bin/publish-chart-to-s3.sh $TAG "nightly/charts-v3" ./charts/mccp
- name: Login to Docker Hub
if: ${{ runner.os == 'Linux' }}
uses: docker/login-action@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
# Update the MCCP chart values.yaml file with the current image tag
make update-mccp-chart-values CHART_VALUES_PATH=$CHART_VALUES_PATH
# Publish the MCCP Helm v3 chart
./bin/publish-chart-to-s3.sh $TAG $GITHUB_EVENT_NAME ./charts/mccp 3
./bin/publish-chart-to-s3.sh $TAG "releases/charts-v3" ./charts/mccp
- name: Login to Docker Hub
if: ${{ runner.os == 'Linux' }}
uses: docker/login-action@v1
Expand Down Expand Up @@ -131,8 +131,8 @@ jobs:
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Publish mccp to s3
run: |
aws s3 cp mccp-${{ env.TAG }}-linux-amd64 s3://weaveworks-wkp/releases/mccp-${{ env.TAG }}-linux-amd64
aws s3 cp mccp-${{ env.TAG }}-darwin-amd64 s3://weaveworks-wkp/releases/mccp-${{ env.TAG }}-darwin-amd64
aws s3 cp cmd/mccp/mccp-${{ env.TAG }}-linux-amd64 s3://weaveworks-wkp/releases/mccp-${{ env.TAG }}-linux-amd64
aws s3 cp cmd/mccp/mccp-${{ env.TAG }}-darwin-amd64 s3://weaveworks-wkp/releases/mccp-${{ env.TAG }}-darwin-amd64
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
make update-mccp-chart-values CHART_VALUES_PATH=$CHART_VALUES_PATH
# Publish the MCCP Helm v3 chart
./bin/publish-chart-to-s3.sh $TAG $GITHUB_EVENT_NAME ./charts/mccp 3
./bin/publish-chart-to-s3.sh $TAG "charts-v3" ./charts/mccp
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
Expand Down
37 changes: 7 additions & 30 deletions bin/publish-chart-to-s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@ set -o errexit
set -o pipefail

TAG=$1
PUBLISH_EVENT=$2
URI=$2
CHART=$3
CHART_VERSION=$4
SED=${SED:-"sed"}
HELM=${HELM:-"helm"}

$HELM version --client

if [ "${CHART_VERSION}" == "2" ]; then
# Init
$HELM init --client-only
fi
SEMVER=$(echo $TAG | $SED 's/^[^0-9]*//')
$SED -i "s/^version: .*$/version: $SEMVER/" ${CHART}/Chart.yaml
$HELM lint "${CHART}"
Expand All @@ -33,30 +28,12 @@ mkdir -p ./pkg
$HELM package "${CHART}" --dependency-update --destination ./pkg/

cd pkg
if [ "${CHART_VERSION}" == "2" ]; then
# Download the existing index.yaml from s3 and update it
aws s3 cp s3://weaveworks-wkp/charts/index.yaml . || echo "No index.yaml found..."
$HELM repo index . --merge index.yaml --url https://s3.us-east-1.amazonaws.com/weaveworks-wkp/charts/
# Upload index and chart to s3
aws s3 cp index.yaml s3://weaveworks-wkp/charts/
aws s3 cp *.tgz s3://weaveworks-wkp/charts/
elif [ "${CHART_VERSION}" == "3" ]; then
if [ "${PUBLISH_EVENT}" == "release" ]; then
URI="releases/charts-v3"
elif [ "${PUBLISH_EVENT}" == "schedule" ]; then
URI="nightly/charts-v3"
else
URI="charts-v3"
fi
# Download the existing index.yaml from s3 and update it
aws s3 cp s3://weaveworks-wkp/${URI}/index.yaml . || echo "No index.yaml found..."
$HELM repo index . --merge index.yaml --url https://s3.us-east-1.amazonaws.com/weaveworks-wkp/${URI}/
# Upload index and chart to s3
aws s3 cp index.yaml s3://weaveworks-wkp/${URI}/
aws s3 cp *.tgz s3://weaveworks-wkp/${URI}/
else
echo "Helm version can be '2' or '3'"
fi
# Download the existing index.yaml from s3 and update it
aws s3 cp s3://weaveworks-wkp/${URI}/index.yaml . || echo "No index.yaml found..."
$HELM repo index . --merge index.yaml --url https://s3.us-east-1.amazonaws.com/weaveworks-wkp/${URI}/
# Upload index and chart to s3
aws s3 cp index.yaml s3://weaveworks-wkp/${URI}/
aws s3 cp *.tgz s3://weaveworks-wkp/${URI}/

# CAREFUL, this is done by .circleci but you can do it manually here if you need to.
# Upload index and new release .tgz back to s3
Expand Down

0 comments on commit 34bff4f

Please sign in to comment.