Skip to content

Support upload image to aws #601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 35 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b9b2eaf
Support upload image to aws
tuteng Apr 7, 2022
92477a8
Fixed file permission
tuteng Apr 7, 2022
b87f632
Update action yml file
tuteng Apr 7, 2022
9d4f108
Update image action yml file
tuteng Apr 7, 2022
41dfd0b
Update version check
tuteng Apr 7, 2022
727ee97
Test download image
tuteng Apr 7, 2022
e65d751
Update var
tuteng Apr 7, 2022
1587acb
Update upload file
tuteng Apr 11, 2022
59d166f
Fixed upload bucket name
tuteng Apr 11, 2022
3ae1ca6
Debug ali oss
tuteng Apr 11, 2022
c379c8c
Fixed command
tuteng Apr 11, 2022
9cbc3d0
Update ali oss config
tuteng Apr 11, 2022
43f7c8c
Fixed bucket
tuteng Apr 11, 2022
53f4efb
Fixed dest path
tuteng Apr 11, 2022
5d3c125
Fixed image save command
tuteng Apr 11, 2022
c972c47
Fixed image list
tuteng Apr 11, 2022
2258992
Fixed command
tuteng Apr 11, 2022
926c651
Fixed image upload
tuteng Apr 12, 2022
5018550
Update image, and add trigger action
tuteng Apr 12, 2022
3ae05c2
Update version
tuteng Apr 12, 2022
a7e362d
Update oss version
tuteng Apr 12, 2022
0653752
Remove no used image
tuteng Apr 12, 2022
f1aec2d
Update image list
tuteng Apr 19, 2022
ce90c4f
Fixed images list
tuteng Apr 19, 2022
4131292
Fixed trigger action
tuteng Apr 19, 2022
9756a4b
Fixed echo download info
tuteng Apr 19, 2022
379d61e
Fixed sn-platform info
tuteng Apr 19, 2022
d9d6056
trigger image upload
tuteng Apr 19, 2022
ce62bbf
Update vault operator image
tuteng Apr 19, 2022
36a1391
Fixed operator image
tuteng Apr 19, 2022
c1ca157
Fixed vault operator image
tuteng Apr 19, 2022
a7a0024
Fixed image
tuteng Apr 19, 2022
80ce0d2
Echo image list
tuteng Apr 19, 2022
76849da
Push 2.9.2.12 image
tuteng Apr 19, 2022
c9098c7
Fixed 2.9.2.13 image
tuteng Apr 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .ci/download_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash
components=(
zookeeper
zookeeper.customTools.backup
zookeeper.customTools.restore
bookie
presto
autorecovery
broker
proxy
pulsar_detector
functions
function_worker
toolset
toolset.kafka
prometheus
alert_manager
grafana
streamnative_console
node_exporter
nginx_ingress_controller
vault
vault_init
bank_vaults
custom_metric_server_prometheus
custom_metric_server
pulsar_metadata
configmapReload
external_dns
functionnmesh
pulsar_operator
bookkeeper_operator
zookeeper_operator
cert_manager_controller
cert_manager_cainjector
cert_manager_webhook
vault_operator)
sn_platform_tag=$1
Copy link
Contributor

@jdmaguire jdmaguire Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should default this or throw a help message & exit if not provided. Otherwise, someone has to open up the file to see what arguments this needs and what they are for.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still working on this test and have some code left to finish, thanks for the suggestion, it seems I should set this pr to draft status

regexp="^sn-platform-([0-9]{1,3})\.([0-9]{0,3})\.([0-9]{0,3})$"
mkdir -p $sn_platform_tag
cd $sn_platform_tag
# if [[ $sn_platform_tag =~ $regexp ]]; then
# curl https://raw.githubusercontent.com/streamnative/charts/${sn_platform_tag}/charts/sn-platform/values.yaml -o values.yaml
curl https://raw.githubusercontent.com/streamnative/charts/fixed/support-upload-image-to-aws/charts/sn-platform/values.yaml -o values.yaml
image_list=""
for i in ${components[@]}; do
repository=$(cat values.yaml | yq .images.$i.repository)
tag=$(cat values.yaml | yq .images.$i.tag)
echo "Downloading docker image: $repository:$tag"
image_list=$image_list" $repository:$tag"
docker pull $repository:$tag
done

uniq_image_list=($(echo ${image_list[*]} | sed 's/ /\n/g'|sort| uniq))
echo ${uniq_image_list}
for j in ${uniq_image_list[@]}; do
image=$(echo ${j} | sed 's/:/-/g;s/\//-/g');
docker save -o ${image}.tar ${j}
echo https://downloads-streamnative-cloud.oss-cn-beijing.aliyuncs.com/sn-products/$sn_platform_tag/${image}.tar
done
# test
# docker save -o $sn_platform_tag.tar jimmidyson/configmap-reload:v0.3.0
# else
# echo "Please use the correct version number format => sn-platform-x.x.x"
# echo "Currently only sn-platform images are supported for upload"
# fi
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,35 @@ jobs:
run: |
.ci/release.sh ${{ github.event.inputs.chart }} release-${{ github.event.inputs.chart }}-${{ github.event.inputs.release }}

# Upload all images to aws s3 and ali oss
- name: Setup environments
run: |
sudo apt update
sudo snap install yq

- name: Download and package all image for sn platform
run: |
.ci/download_image.sh ${{ github.event.inputs.chart }}-${{ github.event.inputs.release }}

- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1
SOURCE_DIR: ${{ github.event.inputs.chart }}-${{ github.event.inputs.release }}
DEST_DIR: ${{ github.event.inputs.chart }}-${{ github.event.inputs.release }}

- name: Install Alibaba Cloud OSSUTIL
run: wget http://gosspublic.alicdn.com/ossutil/1.7.10/ossutil64 && chmod +x ossutil64
- name: Configure Alibaba Cloud OSSUTIL
run: ./ossutil64 config -i ${ALI_ACCESS_KEY_ID} -k ${ALI_SECRET_ACCESS_KEY} -e ${ALI_OSS_ENDPOINT} -c .ossutilconfig
env:
ALI_OSS_ENDPOINT: ${{ secrets.ALI_OSS_ENDPOINT }}
ALI_ACCESS_KEY_ID: ${{ secrets.ALI_ACCESS_KEY_ID }}
ALI_SECRET_ACCESS_KEY: ${{ secrets.ALI_SECRET_ACCESS_KEY }}
- name: Upload the file to the chosen OSS bucket
run: ./ossutil64 --config-file .ossutilconfig cp ${{ github.workspace }}/${{ github.event.inputs.chart }}-${{ github.event.inputs.release }} oss://${{ secrets.ALI_OSS_BUCKET }}/sn-products/${{ github.event.inputs.chart }}-${{ github.event.inputs.release }} -r -f

49 changes: 49 additions & 0 deletions .github/workflows/sn_platform_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# curl -X POST https://api.github.com/repos/streamnative/sn-platform/dispatches -d '{"event_type":"upload-image-to-s3-and-oss","tag":"sn-platform-1.2.38"}'
name: Trigger Upload Image to aws s3 and oss

on:
pull_request:
branches:
- '*'
# repository_dispatch:
# types:
# - upload-image-to-s3-and-oss

jobs:
deploy:
name: Upload sn platform image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup environments
run: |
sudo apt update
sudo snap install yq

- name: Download and package all image for sn platform
run: | # .ci/download_image.sh sn-platform-1.4.0-rc3
.ci/download_image.sh sn-platform-1.4.0-rc3

- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1' # optional: defaults to us-east-1
SOURCE_DIR: sn-platform-1.4.0-rc3
DEST_DIR: sn-platform-1.4.0-rc3

- name: Install Alibaba Cloud OSSUTIL
run: wget http://gosspublic.alicdn.com/ossutil/1.7.10/ossutil64 && chmod +x ossutil64
- name: Configure Alibaba Cloud OSSUTIL
run: ./ossutil64 config -i ${ALI_ACCESS_KEY_ID} -k ${ALI_SECRET_ACCESS_KEY} -e ${ALI_OSS_ENDPOINT} -c .ossutilconfig
env:
ALI_OSS_ENDPOINT: ${{ secrets.ALI_OSS_ENDPOINT }}
ALI_ACCESS_KEY_ID: ${{ secrets.ALI_ACCESS_KEY_ID }}
ALI_SECRET_ACCESS_KEY: ${{ secrets.ALI_SECRET_ACCESS_KEY }}
- name: Upload the file to the chosen OSS bucket
run: ./ossutil64 --config-file .ossutilconfig cp ${{ github.workspace }}/sn-platform-1.4.0-rc3 oss://${{ secrets.ALI_OSS_BUCKET }}/sn-products/sn-platform-1.4.0-rc3 -r -f
63 changes: 49 additions & 14 deletions charts/sn-platform/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,22 @@ monitoring:
images:
zookeeper:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
customTools:
backup:
repository: "streamnative/pulsar-metadata-tool"
tag: "2.9.2.9"
tag: "2.9.2.12.0"
restore:
repository: "streamnative/pulsar-metadata-tool"
tag: "2.9.2.9"
tag: "2.9.2.12.0"
bookie:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
presto:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
# NOTE: allow overriding the presto worker image
# presto_worker:
Expand All @@ -158,32 +158,32 @@ images:
# pullPolicy: IfNotPresent
autorecovery:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
broker:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
proxy:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
pulsar_detector:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
functions:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
function_worker:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
# NOTE: allow overriding the toolset image
toolset:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
kafka:
repository: confluentinc/cp-kafka
Expand Down Expand Up @@ -221,6 +221,9 @@ images:
vault_init:
repository: streamnative/pulsar_vault_init
tag: "v1.0.2"
bank_vaults:
repository: ghcr.io/banzaicloud/bank-vaults
tag: "1.15.2"
custom_metric_server_prometheus:
repository: prom/prometheus
tag: "v2.19.2"
Expand All @@ -231,7 +234,7 @@ images:
pullPolicy: IfNotPresent
pulsar_metadata:
repository: streamnative/sn-platform
tag: "2.9.2.9"
tag: "2.9.2.12.0"
pullPolicy: IfNotPresent
configmapReload:
repository: jimmidyson/configmap-reload
Expand All @@ -250,7 +253,39 @@ images:
repository: gcr.io/google_containers/pause
tag: "0.3.0"
pullPolicy: IfNotPresent

# The list of images that put the operator is here, so that we can export it to aws s3 and ali oss
functionnmesh:
repository: streamnative/function-mesh
tag: v0.1.6
pullPolicy: IfNotPresent
pulsar_operator:
repository: docker.cloudsmith.io/streamnative/operators/pulsar-operator
tag: v0.9.4
pullPolicy: IfNotPresent
bookkeeper_operator:
repository: docker.cloudsmith.io/streamnative/operators/pulsar-operator
tag: v0.9.4
pullPolicy: IfNotPresent
zookeeper_operator:
repository: docker.cloudsmith.io/streamnative/operators/pulsar-operator
tag: v0.9.4
pullPolicy: IfNotPresent
cert_manager_controller:
repository: quay.io/jetstack/cert-manager-controller
tag: v1.3.1
pullPolicy: IfNotPresent
cert_manager_cainjector:
repository: quay.io/jetstack/cert-manager-cainjector
tag: v1.3.1
pullPolicy: IfNotPresent
cert_manager_webhook:
repository: quay.io/jetstack/cert-manager-webhook
tag: v1.3.1
pullPolicy: IfNotPresent
vault_operator:
repository: banzaicloud/vault-operator
tag: "1.3.0"
pullPolicy: IfNotPresent
## TLS
## templates/tls-certs.yaml
##
Expand Down