Skip to content

Commit

Permalink
Adding script for create multicloud release and images and upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarashit committed Mar 27, 2021
1 parent 417594e commit c326810
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions release_multicloud
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env python3

# Copyright 2021 The SODA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys, os, argparse

image_name = "sodafoundation/multi-cloud-"
service_list = ["api", "block", "file", "s3", "datamover", "dataflow", "backend"]
valid_input = ["y", "Y", "Yes", "YES"]
helper = ["-h" "--help"]

#Make changes in the Makefile
def make_makefile_changes(tag):
with open("Makefile", "rt") as inp:
data = inp.read()
data = data.replace('latest', tag)
inp.close()
with open("Makefile", "wt") as inp:
inp.write(data)
inp.close()

#revert changes in the Makefile
def revert_makefile_changes(tag):
with open("Makefile", "rt") as inp:
data = inp.read()
data = data.replace(tag, 'latest')
inp.close()
with open("Makefile", "wt") as inp:
inp.write(data)
inp.close()

# make docker
def make_docker_image():
os.system('make docker')

# push the image to dockerhub
def push_image(tag):
for name in service_list:
image = image_name + name + ':' + tag
print("Pushing image %s" % image)
cmd = "docker push %s" % image
os.system(cmd)

# Create release binary
def make_release_binary():
os.system("make dist")


#Change the release version as per the input
if __name__ == "__main__":
value = input("Enter the release version: ")
os.environ["VERSION"] = value
os.system('echo $VERSION')
test_run = input("Do you want to run test coverage before build and release? ")
if test_run in valid_input:
cmd = "./install/CI/coverage"
os.system(cmd)

make_makefile_changes(value)
make_docker_image()
push_image(value)
make_release_binary()
revert_makefile_changes(value)

0 comments on commit c326810

Please sign in to comment.