Skip to content

Commit

Permalink
Setup pipeline to sync common engineering directory
Browse files Browse the repository at this point in the history
  • Loading branch information
weshaggard committed Jan 24, 2020
1 parent d8578fe commit 8d58637
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
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 generate a PR to be created to 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.
35 changes: 35 additions & 0 deletions eng/pipelines/eng-common-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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
ref: UpdateCreatePullRequestTemplate

pool:
vmImage: windows-2019

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-net
- azure-sdk-for-java
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 }}

0 comments on commit 8d58637

Please sign in to comment.