Skip to content

CI-CREATE-RELEASE_BUNDLE_S3 #48

CI-CREATE-RELEASE_BUNDLE_S3

CI-CREATE-RELEASE_BUNDLE_S3 #48

# This is a basic workflow to help you get started with Actions
name: CI-CREATE-RELEASE_BUNDLE_S3
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
workflow_dispatch:
inputs:
VERSION:
description: hkube version to push freeze
required: true
PREV_VERSION:
description: previous hkube version to compare to
required: false
DEV_VERSION:
description: set to TRUE for dev version
required: false
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
env:
VERSION: '${{ github.event.client_payload.VERSION || github.event.inputs.VERSION }}'
PREV_VERSION: '${{ github.event.client_payload.PREV_VERSION || github.event.inputs.PREV_VERSION }}'
DEV_VERSION: '${{ github.event.client_payload.DEV_VERSION || github.event.inputs.DEV_VERSION }}'
BASE_DIR: '/tmp/downloads'
jobs:
# This workflow contains a single job called "build"
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
# The type of runner that the job will run on
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: cleanup
run: |
echo "Removing unwanted software... "
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
echo "... done"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: '${{ secrets.AWS_S3_ROLE }}'
aws-region: eu-west-1
- name: test credentials
run: |
# test
aws s3 ls s3://downloads.hkube.io
df -h
df -h .
- name: parse version
run: |
echo using version ${VERSION}
VERSION2="${VERSION#[vV]}"
VERSION_MAJOR="${VERSION2%%\.*}"
VERSION_MINOR="${VERSION2#*.}"
VERSION_MINOR="${VERSION_MINOR%.*}"
VERSION_PATCH="${VERSION2##*.}"
BUNDLE_NAME=v${VERSION_MAJOR}.$VERSION_MINOR
echo BUNDLE_NAME=$BUNDLE_NAME >> $GITHUB_ENV
echo VERSION_PATCH=$VERSION_PATCH >> $GITHUB_ENV
- name: get chart
run: |
if [ -z $DEV_VERSION ]
then
wget https://hkube.io/helm/hkube-$VERSION.tgz && tar xfv hkube-$VERSION.tgz
else
wget https://hkube.io/helm/dev/hkube-$VERSION.tgz && tar xfv hkube-$VERSION.tgz
fi
- name: create download script
run: |
curl -Lo image-export-import https://github.com/kube-HPC/image-exprort-import/releases/latest/download/image-export-import && chmod +x image-export-import
./image-export-import createScript --path /tmp/download-hkube.sh --chartPath ./hkube/ --options "global.sidecars.fluent_bit.enable=true,etcd.enable=true,jaeger.enable=true,nginx-ingress.enable=true,minio.enable=true,global.image_pull_secret.use_existing=false,global.clusterName=download,global.k8senv=kubernetes"
- uses: actions/upload-artifact@v2
with:
name: download-hkube.sh
path: /tmp/download-hkube.sh
- name: download version
run: |
./scripts/getHkubeVersion.sh
env:
GH_TOKEN: '${{ secrets.GH_TOKEN }}'
COMPRESS: "true"
- name: upload
run: |
if [ -z $PREV_VERSION ]
then
export TAR_FILE_NAME=hkube-${VERSION}.tgz
else
export TAR_FILE_NAME=hkube-diff-${PREV_VERSION}-${VERSION}.tgz
fi
aws s3 cp --acl public-read ${BASE_DIR}/hkube-${VERSION}/${TAR_FILE_NAME} s3://downloads.hkube.io/${VERSION}/