![]() TargetFolder: '$(System.DefaultWorkingDirectory)/Git/IntegrationPlaybook-DataTransformationModeller' SourceFolder: '$(System.DefaultWorkingDirectory)/_DataTransformation.Modeller/drop/code' task: 'Copy Files to: $(System.DefaultWorkingDirectory)/Git/IntegrationPlaybook-DataTransformationModeller' ![]() Next ill copy the latest version of the code into this folder from my build artifact. Notice that the folder path is the folder added by the git clone so you will need to be aware of that. ![]() SourceFolder: '$(System.DefaultWorkingDirectory)/Git/IntegrationPlaybook-DataTransformationModeller' task: 'Delete files from $(System.DefaultWorkingDirectory)/Git/IntegrationPlaybook-DataTransformationModeller' Once everything has been copied from Git to this local folder I will then do a delete on everything in the folder: steps: The parameter $GIBHUT_REPO_URL can come from your pipeline variables and is just the url to your repo. WorkingDirectory: '$(System.DefaultWorkingDirectory)/Git' Git config -global user.name 'Michael Stephenson' Notice that the working directory is now the folder I created in the above step. Next we have the script which will configure git and copy down the git repo to this new local folder. This task will create a folder which will be used to sync the existing bit repo into. WorkingDirectory: '$(System.DefaultWorkingDirectory)' First off we have the Create Folder for Git. If we look at the git related bits you can see the below yaml snippets show what they do. In the original CI build id taken out anything i didnt want to share such as connection information that might have been in a config file and similar things. Once the pipeline runs I have a folder called code in my working directory which will have the copy of the code in it. If you look at my pipeline stage it looks like below The original build artifact from my CI pipeline had also included a copy of the code in its zip file but you could equally get it from a repo if needed instead. ![]() I then added a new stage to the pipeline to do the push to github. In my case my existing tool was using classic devops pipelines to compile a version of the code and I had a release pipeline which would release it when I needed. I wanted to run a pipeline which would get a copy of the code and then sync it into my repo on GitHub so I can share a new version of the code when I choose.I run a pipeline from my repo which builds the code and gives me the tool to use when I need it.I have a tool built which I have in my own Azure DevOps repo which ive used for a while and I wanted to share a copy of the code so others could use it and modify their own versions if they want.I thought id note down what I did incase anyone has a similar scenario. I thought this seemed like it would be quite a common scenario but there didnt really seem to be anything I could find to show you how to do this and I was also surprised when there wasnt any out of the box task I could add to the pipeline which would do it. Sometimes your using Azure DevOps for a personal project or something for work and you have a sample that you want to share with the community and you want to copy the code to a github repo so its in the common place for sharing stuff with others. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |