Skip to content

Commit

Permalink
Merge pull request #353 from Azure/SetupCommonSyncPipeline
Browse files Browse the repository at this point in the history
Setup pipeline to sync common engineering directory
  • Loading branch information
weshaggard authored Jan 24, 2020
2 parents a5d4112 + 099dfc6 commit f79dab5
Show file tree
Hide file tree
Showing 3 changed files with 78 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 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 }}

0 comments on commit f79dab5

Please sign in to comment.