Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Added shell script used in Azure Pipelines build #53

Merged
merged 3 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ terraform.tfstate
terraform.tfstate.backup
translations
istio-1.0.4
.DS_Store
59 changes: 59 additions & 0 deletions gitops/azure-devops/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cd /home/vsts/work/1/s/

# If the version number is not provided, then download the latest
if [ -z "$VERSION" ]
then
VERSIONS=$(curl -s https://api.github.com/repos/Microsoft/fabrikate/tags)
LATEST_RELEASE=$(echo $VERSIONS | grep "name" | head -1)
LATEST_VERSION=`echo "$LATEST_RELEASE" | cut -d'"' -f 4`
else
echo "Fabrikate Version: $VERSION"
fi

echo "Downloading Fabrikate..."
echo "Latest Fabrikate Version: $LATEST_VERSION"
wget "https://github.com/Microsoft/fabrikate/releases/download/$LATEST_VERSION/fab-v$LATEST_VERSION-linux-amd64.zip"
unzip fab-v$LATEST_VERSION-linux-amd64.zip -d fab
export PATH=$PATH:/home/vsts/work/1/s/fab
fab install

fab generate prod
echo "FAB GENERATE PROD COMPLETED"
ls -a

# Git
cd /home/vsts/work/1/s/
echo "GIT CLONE"
git clone https://github.com/$AKS_MANIFEST_REPO.git
repo_url=https://github.com/$AKS_MANIFEST_REPO.git
repo=${repo_url##*/}
echo "REPO:$repo"
repo_name=${repo%.*}
echo "REPO_NAME:$repo_name"
cd $repo_name

echo "GIT CHECKOUT"
git checkout master
echo "GIT STATUS"
git status
echo "Copy yaml files to repo directory..."
rm -rf prod/
cp -r /home/vsts/work/1/s/generated/* .
ls /home/vsts/work/1/s/$repo_name
echo "GIT ADD"
git add *

# Set git identity
git config user.email "admin@azuredevops.com"
yradsmikham marked this conversation as resolved.
Show resolved Hide resolved
git config user.name "Automated Account"

echo "GIT COMMIT"
git commit -m "Updated k8s manifest files"
echo "GIT STATUS"
git status
echo "GIT PULL"
git pull
echo "GIT PUSH"
git push https://$ACCESS_TOKEN@github.com/$AKS_MANIFEST_REPO.git
echo "GIT STATUS"
git status