Commit 6237e523 by 据说甜蜜呢

添加文件

parent 1ac4179b
#!/bin/bash
set -e
function ToLower()
{
declare input=$1
declare output=($(echo "${input}" | tr 'A-Z' 'a-z'))
eval $2=${output}
}
function GetServices()
{
declare svcs=($(ls ./src/Services|xargs -d '/' echo))
eval $1="${svcs}"
}
function GetServiceCsProjFile()
{
declare prefix=${1}
declare name=${2}
declare csprojFile="./src/Services/${prefix}/${name}/${name}.csproj"
eval $3="${csprojFile}"
}
function GetServiceName()
{
declare prefix=${1}
declare name=($(ls ./src/Services/${prefix}|head -n 1|xargs -d '/' echo))
eval $2="${name}"
}
function GetAppName()
{
declare name=($(grep -oP '(?<=AppName>)[^<]+' "./devops/app.props"))
eval $1="${name}"
}
function GetSolutionName()
{
declare name=($(grep -oP '(?<=SolutionName>)[^<]+' "./devops/app.props"))
eval $1="${name}"
}
function GetImageUserName()
{
declare name=($(grep -oP '(?<=ImageUserName>)[^<]+' "devops/deploy.props"))
eval $1="${name}"
}
function GetCiCdSettings()
{
declare all=($(grep -oP '(?<=AllPublishable>)[^<]+' "/tmp/cicd.props"))
declare no=($(grep -oP '(?<=NoPublishable>)[^<]+' "/tmp/cicd.props"))
eval $1=${all}
eval $2=${no}
}
function GetMajor()
{
declare m=($(grep -oP '(?<=Major>)[^<]+' "./devops/version.props"))
eval $1=${m}
}
function GetVersion()
{
declare major=($(grep -oP '(?<=Major>)[^<]+' "./devops/version.props"))
declare minor=($(grep -oP '(?<=Minor>)[^<]+' "./devops/version.props"))
declare patch=($(grep -oP '(?<=Patch>)[^<]+' "./devops/version.props"))
eval $1="${major}.${minor}.${patch}"
}
function GetImageRegistrySettings()
{
declare host=($(grep -oP '(?<=ImageRegistryHost>)[^<]+' "devops/deploy.props"))
declare username=($(grep -oP '(?<=ImageUserName>)[^<]+' "devops/deploy.props"))
eval $1=${host}
eval $2=${username}
}
function GetAccessTokenOf()
{
declare token=($(grep -oP "(?<=${Environment}AccessToken>)[^<]+" "devops/deploy.props"))
eval $1="${token}"
}
function IsPublishableOf()
{
declare prefix=$0
declare isP=($(grep -oP "(?<=${prefix}Publishable>)[^<]+" "/tmp/cicd.props"))
eval $1=isP
}
\ No newline at end of file
#!/bin/bash
set -e
# Import external functions
chmod +x ./devops/PipeLines/Functions.core.sh
source ./devops/PipeLines/Functions.core.sh
function CI()
{
declare serviceName=$1
declare publishFile=$2
declare publishOutputDir="/tmp/${serviceName}"
GetVersion version
GetImageUserName registryUserName
# repository name must be lowercase
ToLower "${RegistryHost}/${registryUserName}/${serviceName}:${version}" imagefullname
echo ""
echo "Begin delivering for ${serviceName}..."
echo "Tips: Image full name: ${imagefullname}"
mkdir -p ${publishOutputDir}
dotnet publish ${publishFile} -o ${publishOutputDir} -c release --no-restore
docker build -t ${imagefullname} ${publishOutputDir}
docker push ${imagefullname}
rm -fr ${publishOutputDir}
echo "Delivery for ${serviceName} has been successful."
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment