Merge branch 'master' into FluxV2
This commit is contained in:
Коммит
cec5fee729
|
@ -0,0 +1,101 @@
|
|||
name: release
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
token: ${{ secrets.PAT }}
|
||||
|
||||
- name: Get Release Number
|
||||
run: |
|
||||
tag_number=$GITHUB_REF
|
||||
|
||||
# v1.0.0 -> 1-0-x
|
||||
echo "RELEASE_NUMBER=$(echo $tag_number | awk -F"." '{print $1"-"$2"-x"}' | cut -c12-)" >> $GITHUB_ENV
|
||||
echo "VERSION_NUMBER=$(echo $tag_number | cut -c12-)" >> $GITHUB_ENV
|
||||
|
||||
|
||||
- name: Sub-branch source code
|
||||
run: |
|
||||
echo $RELEASE_NUMBER
|
||||
echo $VERSION_NUMBER
|
||||
./utils/subbranch.sh main release/$RELEASE_NUMBER
|
||||
|
||||
|
||||
- name: Checkout Manifests
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/${{ secrets.MANIFESTS_REPO_NAME }}
|
||||
path: manifests
|
||||
token: ${{ secrets.PAT }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Sub-branch Dev
|
||||
run: |
|
||||
./../utils/subbranch.sh dev release/$RELEASE_NUMBER/dev
|
||||
working-directory: manifests
|
||||
|
||||
- name: Sub-branch Stage
|
||||
run: |
|
||||
./../utils/subbranch.sh stage release/$RELEASE_NUMBER/stage
|
||||
working-directory: manifests
|
||||
|
||||
- name: Checkout Fleet
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/${{ secrets.FLEET_REPO_NAME }}
|
||||
path: fleet
|
||||
token: ${{ secrets.PAT }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Flux
|
||||
run: |
|
||||
curl -s https://fluxcd.io/install.sh | sudo bash
|
||||
|
||||
- name: Add release to fleet in Dev
|
||||
run: |
|
||||
./../utils/add-release-to-fleet.sh dev ${{ github.repository_owner }} $RELEASE_NUMBER ${{ secrets.MANIFESTS_REPO}} release/$RELEASE_NUMBER/dev
|
||||
working-directory: fleet
|
||||
|
||||
- name: Create Pull Request to Dev fleet
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
path: fleet
|
||||
token: ${{ secrets.PAT }}
|
||||
commit-message: add release ${{ env.RELEASE_NUMBER }} manifests for ${{ github.repository_owner }} to dev
|
||||
title: add release ${{ env.RELEASE_NUMBER }} manifests for ${{ github.repository_owner }} to dev
|
||||
branch: ${{ github.repository_owner }}/${{ env.RELEASE_NUMBER }}-dev
|
||||
|
||||
- name: Add release to fleet in Stage
|
||||
run: |
|
||||
./../utils/add-release-to-fleet.sh stage ${{ github.repository_owner }} $RELEASE_NUMBER ${{ secrets.MANIFESTS_REPO}} release/$RELEASE_NUMBER/stage
|
||||
working-directory: fleet
|
||||
|
||||
- name: Create Pull Request to Stage fleet
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
path: fleet
|
||||
token: ${{ secrets.PAT }}
|
||||
commit-message: add release ${{ env.RELEASE_NUMBER }} manifests for ${{ github.repository_owner }} to stage
|
||||
title: add release ${{ env.RELEASE_NUMBER }} manifests for ${{ github.repository_owner }} to stage
|
||||
branch: ${{ github.repository_owner }}/${{ env.RELEASE_NUMBER }}-stage
|
||||
|
||||
- name: Generate Helm Charts
|
||||
run: |
|
||||
./utils//generate-manifests.sh ${{ secrets.MANIFEST_ARTIFACT_PATH }} gen_manifests
|
||||
env:
|
||||
APP_VERSION: ${{ env.VERSION_NUMBER }}
|
||||
|
||||
- name: Publish Helm Chart
|
||||
run: |
|
||||
./utils//publish_helm_chart.sh gen_manifests/hld ${{ secrets.HELM_CHARTS_REPO_NAME }} ${{ secrets.HELM_CHARTS_URL }}
|
||||
env:
|
||||
TOKEN: ${{ secrets.HELM_CHARTS_PAT }}
|
|
@ -7,9 +7,7 @@ resources:
|
|||
source: "arc-cicd-demo-src CI"
|
||||
trigger:
|
||||
branches:
|
||||
# Until Flux V2 integration is in Public Preview, work with FluxV2 branch.
|
||||
# Once Flux V2 integration is in Public Preview, FluxV2 branch will be merged into the default branch.
|
||||
- FluxV2
|
||||
- master
|
||||
repositories:
|
||||
- repository: Manifest
|
||||
type: git
|
||||
|
|
|
@ -8,8 +8,6 @@ parameters:
|
|||
|
||||
steps:
|
||||
- checkout: self
|
||||
# - checkout: git://$(System.TeamProject)/$(MANIFESTS_REPO)
|
||||
# persistCredentials: true
|
||||
- checkout: Manifest
|
||||
persistCredentials: true
|
||||
|
||||
|
@ -49,4 +47,4 @@ steps:
|
|||
displayName: Create Pull Request
|
||||
condition: ne(variables['GIT_STATUS'], '')
|
||||
name: "Create_PR"
|
||||
workingDirectory: ${{ parameters.MANIFEST_DIR }}
|
||||
workingDirectory: ${{ parameters.MANIFEST_DIR }}
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 63 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 48 KiB |
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
env_name=$1
|
||||
tenant_name=$2
|
||||
release_number=$3
|
||||
manifests_repo=$4
|
||||
manifests_branch=$5
|
||||
|
||||
pr_user_name="Git Ops"
|
||||
pr_user_email="agent@gitops.com"
|
||||
|
||||
git config --global user.email $pr_user_email
|
||||
git config --global user.name $pr_user_name
|
||||
|
||||
git checkout $env_name
|
||||
./utils/add-release-env.sh $tenant_name $release_number $manifests_repo $manifests_branch
|
||||
|
||||
git add *
|
||||
if [[ `git status --porcelain | head -1` ]]; then
|
||||
git commit -m 'add release to fleet'
|
||||
fi
|
|
@ -0,0 +1,56 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage:
|
||||
# publish_helm_chart.sh FOLDER_WITH_CHART CHART_REPO_NAME CHART_REPO_URL
|
||||
|
||||
set -euo pipefail # fail on error
|
||||
|
||||
FOLDER_WITH_CHART=$1
|
||||
CHART_REPO_NAME=$2
|
||||
CHART_REPO_URL=$3
|
||||
|
||||
|
||||
|
||||
DEST_BRANCH="gh-pages"
|
||||
|
||||
pr_user_name="Git Ops"
|
||||
pr_user_email="agent@gitops.com"
|
||||
|
||||
git config --global user.email $pr_user_email
|
||||
git config --global user.name $pr_user_name
|
||||
|
||||
# Clone chart repo
|
||||
echo "Clone chart repo"
|
||||
repo_url="${CHART_REPO_NAME#http://}"
|
||||
repo_url="${CHART_REPO_NAME#https://}"
|
||||
repo_url="https://automated:$TOKEN@$repo_url"
|
||||
|
||||
echo "git clone $repo_url -b $DEST_BRANCH --depth 1 --single-branch"
|
||||
|
||||
git clone $repo_url -b $DEST_BRANCH --depth 1 --single-branch
|
||||
|
||||
echo "git clone"
|
||||
|
||||
repo=${CHART_REPO_NAME##*/}
|
||||
repo_name=${repo%.*}
|
||||
|
||||
for app in `find $FOLDER_WITH_CHART -type d -maxdepth 1 -mindepth 1`;
|
||||
do
|
||||
echo $app
|
||||
ls -ltr $app
|
||||
helm package $app/helm
|
||||
cp *.tgz $repo_name/
|
||||
done
|
||||
|
||||
cd $repo_name
|
||||
helm repo index . --url $CHART_REPO_URL
|
||||
|
||||
git add -A
|
||||
echo "git status"
|
||||
git status
|
||||
|
||||
git commit -m "add a new chart"
|
||||
git push origin
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
orig_branch_name=$1
|
||||
branch_name=$2
|
||||
|
||||
git ls-remote --exit-code --heads origin $branch_name 2> /dev/null
|
||||
|
||||
if [ $? -eq 2 ]
|
||||
then
|
||||
echo "Branch $branch_name doesn't exist"
|
||||
git checkout origin/$orig_branch_name
|
||||
git checkout -b $branch_name
|
||||
git push --set-upstream origin $branch_name
|
||||
exit 0
|
||||
fi
|
Загрузка…
Ссылка в новой задаче