Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup pipeline to sync common engineering directory #353

Merged
merged 1 commit into from
Jan 24, 2020
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
12 changes: 12 additions & 0 deletions eng/common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Common Engineering System

The `eng/common` directory contains engineering files that are common across the various azure-sdk language repos.
It should remain relatively small and only contain textual based files like scripts, configs, or templates. It
should not contain binary files as they don't play well with git.

# Updating

Any updates to files in the `eng/common` directory should be made in the [azure-sdk-tools](https://github.com/azure/azure-sdk-tools) repo.
All changes made will cause a PR to created in all subscribed azure-sdk language repos which will blindly replace all contents of
the `eng/common` directory in that repo. For that reason do **NOT** make changes to files in this directory in the individual azure-sdk
languages repos as they will be overwritten the next time an update is taken from the common azure-sdk-tools repo.
40 changes: 40 additions & 0 deletions eng/pipelines/eng-common-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Mirror the eng/common folder to all subscribed langauge repos.

trigger:
branches:
include:
- master
paths:
include:
- eng/common

pr: none

resources:
repositories:
- repository: azure-sdk-build-tools
type: git
name: internal/azure-sdk-build-tools

pool:
vmImage: ubuntu-18.04

jobs:
- job: SyncEngCommon
displayName: Sync eng/common Directory

steps:
- template: tools/clone-buildtools/clone-buildtools.yml@azure-sdk-build-tools
- template: ./templates/steps/sync-directory.yml
parameters:
CommitMessage: Sync eng/common directory with azure-sdk-tools repository
DirectoryToSync: eng/common
Repos:
- azure-sdk-for-android
- azure-sdk-for-c
- azure-sdk-for-go
- azure-sdk-for-ios
- azure-sdk-for-java
- azure-sdk-for-js
- azure-sdk-for-net
- azure-sdk-for-python
26 changes: 26 additions & 0 deletions eng/pipelines/templates/steps/sync-directory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
Repos: []
DirectoryToSync: eng/common
CommitMessage: commit-message-not-set

steps:

- ${{ each repo in parameters.Repos }}:
- pwsh: |
git clone --branch master https://github.com/azure/${{ repo }}
$repoPath = "${{ repo }}/${{ parameters.DirectoryToSync }}"

if (!(Test-Path $repoPath)) { mkdir $repoPath }
rm -v -r $repoPath/*.*
cp -v -r $(Build.SourcesDirectory)/${{ parameters.DirectoryToSync }}/*.* $repoPath
ls -r $repoPath

displayName: Copy ${{ parameters.DirectoryToSync }} from azure-sdk-tools to ${{ repo }}

- template: pipelines/steps/create-pull-request.yml@azure-sdk-build-tools
parameters:
RepoName: ${{ repo }}
PRBranchName: sync-${{ parameters.DirectoryToSync }}
CommitMsg: ${{ parameters.CommitMessage }}
PushArgs: -f
WorkingDirectory: $(System.DefaultWorkingDirectory)/${{ repo }}