diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4b44b3a44..e74756c00 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -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 diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 3dfdd319b..945cd2384 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c8cb1e260..c2dde7122 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 @@ -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/') diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8d19e9716..c58cd7d22 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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: diff --git a/bin/publish-chart-to-s3.sh b/bin/publish-chart-to-s3.sh index cf840560c..fb47eec9d 100755 --- a/bin/publish-chart-to-s3.sh +++ b/bin/publish-chart-to-s3.sh @@ -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}" @@ -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