Lets say one of the steps is replace content of one file with another file using CmdLine script task in yaml file. After pipeline runs do changes made to that file stick around or are they discarded?
If you are talking about hosted runners, the changes will be discarded. If the file is part of your repository, you can check it in within your pipeline to persist the changes.
Related
Present we kept multiple pipelines in separate yml files and all of them are included in the mail ci yml file.
using include statements.
Is there anyway to make it conditional.
Like I will have pipeline1 and pipeline2 yaml files.
So I can create another pipeline.yml where I can choose among the above two files based on some condition.
Gitlab is designed for deterministic pipelines, all other solutions add-on that looks implicit.
Web service
Include in .gitlab-ci.yml link to the web server, which could be a dynamically generated yml file.
include:
- 'https://your-service.com/gitlab-ci-generate'
Unfortunately, It's not possible to use CI variables in link to server. gitlab issue link
Dynamic child pipelines
You have complete control of the pipeline. Write a simple bash script, which renames your pre-pushed .yml files and executes that pipeline.
I have created a Release in the Azure DevOps environment, and added the Archive File task to my stage. I want the name of the zip file to include the date the file was created on, but there doesn't seem to be syntax that allows me to do it. Does anyone know of a way to include the date in the file name?
Looks you could not use that directly in Archive file to create of the task, the workaround is to configure the Release name format with $(Date: yyyyMMdd) in the release pipeline -> Options like below.
Then in the task, reference it with $(Release.ReleaseName), e.g. xxxxxx/test-$(Release.ReleaseName).zip.
Run the task, it works on my side.
I'm using a deployment slot called staging on my Azure web.
My application use some specfic files settings.I would replace these file after swapping.
Is there a way to do a post-swap ? I'd like to replace some files automatically when the swap is finish ( to put the new settings )
Thanks
I think that the path of least resistance for you is going to be to use an Azure DevOps Pipeline. A pipeline is made up of one or more tasks, and there are lots of tasks to choose from.
You can check out source code from a specific branch, build, publish to a slot, swap slots, and copy files using scripted pipelines.
Here is a full list of available tasks. If you would like to copy files from within a repo from one place to another, just take a look at the command line task. The pipeline runs on a Windows or Linux machine (your choice when you choose a Build Agent), so you can use normal DOS copy commands to move files around.
When the pipeline runs, it first downloads the repo files (Get Sources). Then I can unit test/build the project using a command line task if required. This is followed by deleting the files using the 'Delete Files' task. Any environment variables are scoped to this pipeline only and get cleared when pipeline execution completes. Any files created remain forever (unless deleted using 'Delete Files' or command line task).
What is the scope of the command line and delete files pipeline tasks running on an hosted agent? Can it access the entire hard disk of the agent (like all drives/files)? Is it build folder scoped or agent folder scoped or entire agent hard disk scoped?
The scope is to the entire hard disk.
You can use Command Line or any other tasks and perform operations in your system, not only in the build agent folder.
I have a release pipeline which i use to deploy my resources to other environments. All works fine but the problem is that every time i deploy, all the resources even if no modification is made, are deployed. Is there a way through which i can do selective deployment; i.e. I deploy only those resources which have been modified. Any help would do. Thanks.
That`s a broad question. There is no out-of-box feature to select units to deploy. But you can use variables in the release pipeline:
Define a variable for each resource/unit and set some default value and "Settable at release time" property.
For each resource, define a separate task to deploy and define the custom condition, like: and(succeeded(), eq(variables['Custom.DeployUnit1'], 'YES'))
You can update these variables at the release creation time:
Is there any way to do selective deployment in azure devops?
There is no such out of box way to selective deployment in azure devops.
That because Azure devops release does not support release only changed files since only release changed files not always meaningful and could not archive what the project intend to release (such as the config file only changed in a commit).
But you could create a PowerShell script to compare timestamp for all files:
Create XML file that stores the last upload/publish information of
each files (e.g. file name, date time, changeset/commit version).
Create a PowerShell script file that included the logical to compare
files (get files metadata and compare with that XML file) and copy
updated files to specific folder
Publish the files in that folder
Check the similar thread for some more details.
Besides, if deploying via the deploy.cmd or MSDeploy.exe, you could also use the the -useChecksum WebDeploy flag:
WebDeploy/MSDeploy Quick Tip: Only Deploy Changed Files
Hope this helps.