Showing
2 changed files
with
0 additions
and
98 deletions
docker-java-shell/expectPackage.exp
deleted
100644 → 0
1 | -#!/usr/bin/expect | ||
2 | - | ||
3 | -set CD_PATH [lindex $argv 0] | ||
4 | -set CONFIG_PATH [lindex $argv 1] | ||
5 | -set GLOBAL_CONFIG_PATH [lindex $argv 2] | ||
6 | - | ||
7 | -set timeout -1 | ||
8 | - | ||
9 | -cd $CD_PATH | ||
10 | - | ||
11 | -spawn sh ./mvn-package.sh $CONFIG_PATH $GLOBAL_CONFIG_PATH | ||
12 | - | ||
13 | -expect "您需要现在更新此文件吗" | ||
14 | -send "Yes\r" | ||
15 | - | ||
16 | -expect "请选择" | ||
17 | -send "Quit\r" | ||
18 | - | ||
19 | -expect "即将保存到文件" | ||
20 | -send "Yes\r" | ||
21 | - | ||
22 | -expect eof |
1 | -#!/bin/bash | ||
2 | -function usage(){ | ||
3 | -echo "----------------------------------" | ||
4 | -echo "参数说明:" | ||
5 | -echo "-g : 代码所在的组名" | ||
6 | -echo "-b : 代码所在的分支名" | ||
7 | -echo "-a : 代码所属系统名" | ||
8 | -echo "-s : 部署环境名" | ||
9 | -echo "-i : 镜像信息 " | ||
10 | -echo "" | ||
11 | -echo "举例:sh packageDockerImage.sh -g yoho30 -b master -a yoho-gateway -s yoho-online -w /Data/dockerPackage" | ||
12 | -echo "----------------------------------" | ||
13 | -} | ||
14 | -USER=$(whoami) | ||
15 | -if [[ "$USER" != "root" ]];then | ||
16 | - echo "ERROR:需切换到root用户!" | ||
17 | - exit 1 | ||
18 | -fi | ||
19 | -if [[ $# -lt 1 ]];then | ||
20 | - usage | ||
21 | -exit 1 | ||
22 | -fi | ||
23 | - | ||
24 | -while getopts "g:b:a:s:w:" arg | ||
25 | -do | ||
26 | -case $arg in | ||
27 | -g) | ||
28 | -CODE_GROUP=$OPTARG | ||
29 | -;; | ||
30 | -w) | ||
31 | -WORK_SPACE=$OPTARG | ||
32 | -;; | ||
33 | -b) | ||
34 | -CODE_BRANCH=$OPTARG | ||
35 | -;; | ||
36 | -a) | ||
37 | -SYSTEM_NAME=$OPTARG | ||
38 | -;; | ||
39 | -s) | ||
40 | -ENV_NAME=$OPTARG | ||
41 | -;; | ||
42 | -h) | ||
43 | -usage | ||
44 | -exit 1 | ||
45 | -;; | ||
46 | -?) | ||
47 | -echo "ERROR:未知的参数!" | ||
48 | -exit 1 | ||
49 | -;; | ||
50 | -esac | ||
51 | -done | ||
52 | - | ||
53 | -if [[ ! $CODE_GROUP || ! $CODE_BRANCH || ! $SYSTEM_NAME || ! $ENV_NAME ]];then | ||
54 | - echo "ERROR:参数不全!" | ||
55 | - exit 1 | ||
56 | -fi | ||
57 | -CURRENT_PATH=$(cd `dirname $0`; pwd) | ||
58 | -PACKAGE_PATH=$WORK_SPACE | ||
59 | - | ||
60 | -cd $PACKAGE_PATH | ||
61 | - | ||
62 | -#下包 | ||
63 | -git clone -b master git@git.yoho.cn:yohoops/auto_deploy_test.git | ||
64 | -git clone -b $CODE_BRANCH git@git.yoho.cn:$CODE_GROUP/$SYSTEM_NAME.git | ||
65 | - | ||
66 | -#打包 | ||
67 | -source /etc/profile | ||
68 | -AUTOCONFIG_PATH=$PACKAGE_PATH/auto_deploy_test/autoconfig/$ENV_NAME | ||
69 | -expect $CURRENT_PATH/expectPackage.exp $PACKAGE_PATH/$SYSTEM_NAME/bin $AUTOCONFIG_PATH/$SYSTEM_NAME-autoconfig.properties $AUTOCONFIG_PATH/global-autoconfig.properties | ||
70 | - | ||
71 | -#解包 | ||
72 | -TARGET_PAHT=$PACKAGE_PATH/$SYSTEM_NAME/deploy/target | ||
73 | -NAMESPACE=$(cat ${TARGET_PAHT}/bin/env.sh | grep SERVER_NAMESPACE= | awk -F '=' '{print $2}') | ||
74 | -cd $TARGET_PAHT | ||
75 | -mv *.war ${NAMESPACE}.war | ||
76 | -echo "==============${NAMESPACE}.war" |
-
Please register or login to post a comment