solving msdeploy recursive skip on sync conflict - deployment

I'm trying to use a msdeploy sync command, skipping a given folder that are all around the destination directory.
Command I'm trying is:
msdeploy.exe -verb:sync -source:dirPath="C:\SomeFullSourcePath"
-dest:dirPath="C:\SomeFullDestPath"
-skip:objectName=dirPath,absolutePath=.*\\FolderToIgnoreAtAnyLevel
It works fine, except when trying to delete a folder, it goes like this:
folders are synced up to date
we want to delete a folder, so it is deleted from source
as pretty much any folder, in the destination it contains one of the folders that are skipped
sync is started, but it naturally fails / I've reprod it to the particular scenario, so I'm assuming what happens is the skip rule on these children folders prevents the parents from being deleted (error is "the directory is not empty")
Is there any simple way to workaround this issue?
Constraint: it must only delete the ignored folders If the parent folder is being deleted. The ignored folders can't be present at the source.

Related

How to clean up and create a Archiving strategy for a folder on Github

I have
A git repository
A folder on this repository
To this folder I upload .SQL files. A new DDL is a new .SQL file and it is uploaded to the same folder as this is the place from which a CICD process kicks off to act upon this new file. I do change the sql code now and then but have no use for them after a certain point as it gets executed to the ultimate database via Liquibase
The Problem
Over time this folder now has close to 5000 .SQL files and growing everyday
Its getting cumbersome to navigate and find anything in this folder
The CICD build out of this folder is taking a lot of time it zips the entire folder
I want to
Archive/Remove everything more than 3 months old from the main folder
Move the old files to an Archived location so that I can refer to them
Get the file count down to a manageable level
Possibly do the archiving in a automated way without manual intervention
I Do not want to
Delete the files as I have to maintain a history
Change the process as may be have only one sql file and keep changing it.
I do not want Delete the files as I have to maintain a history
And yet, this is the simplest solution, as you still list the history of a deleted file.
# filter the deleted file to find one:
git log --diff-filter=D --summary | grep pattern_to_search
# Find the log of a deleted file:
git log --all -- FILEPATH
That means your process would simply:
list all files older than a certain date
add their name to a "catalog" file (in order to query them easily later on)
delete (git rm) them (their history is still there
For any file present in the "catalog" file, you still can check their log with:
git log -- a/deleted/file

How to mirror/synchronize a local workspace folder with the server folder?

I have a folder that regularly gets updated. This folder is a part of a TFS workspace. I need to commit all those changes to the workspace once they occur (add what isn't there, delete what was removed and update what was changed).
Currently, I have a script that runs tf vc folderdiff command on the folder and its server counterpart, parses out the output to get three lists - files that need to be added, deleted and updated. It then manually adds, deletes and updates those files by invoking tf add/delete/checkout on batches of files (trying to add/delete/checkout in one go can cause an error if there are too many files in the list).
There has to be some better way. Is there some kind of tf command where I can tell it, look at this local folder, look at the server folder that is mapped to it and make the server folder look exactly the same? Bonus points if I can specify some kind of filter to exclude certain paths or file names/extensions.
Apparently there exists a tf reconcile command. You can learn more about the syntax here: https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/reconcile-command
Off the top of my head, the following command should do what I want:
tf reconcile [path to folder] /promote /adds /deletes /recursive /noprompt
There is also /exclude that can be used to filter unwanted files, so I get the bonus points too.
Of course I had to stumble upon it right after asking a question...

Ignore files within the 'Delete Files Task'

As part of my install scripts for Visual Studio Online (VSO / VSTS) I delete the files in my directory shortly after uninstalling the services.
We have configuration files and logs that I'd like to preserve but everytime I try to tell the 'Delete Files Task' to ignore those files it deletes them anyway.
What I want is for ALL files in the Bifrost directory to be deleted except for
The Logs folder
App.Connections.Config
App.Queues.Config
Can someone help please?
If the files you want to delete are located in the agent folder or the subfolder of the agent machine, you can use Delete Files Task. Because the Source Folder of Delete Files Task can only be specified for the agent machine.
If the files you want to delete are located on another remote machine, you should use Powershell task or RemoteDelete task to delete the files.
For powershell task, there are many powershell script on the web to delete files from remote machine.
For RemoteDelete task, you can set as below:
Input your remote machine’s IP, username and password.
Path: the directory for Bifrost folder, such as D:\test\Bitfrost
Include Items: folders and files you want to delete and separate with comma (,). Such as delete folder temp and file *.txt, you can specify with temp,*.txt
Exculde Items: folders and files you want to keep. For you situation, you
should specify as Logs,App.Connections.Config,App.Queues.Config
Note: the Include Items option can't leave empty or use **, otherwise it will delete all the files and folders in Bifrost.

Excluding files/folders from VSTS publish

We are using the new VSO/VSTS style build within TFS on premise, 2015 Update 1 as of yesterday.
During the publish build artifacts stage we want to copy all the files/folders from a root bar 2 sub folders.
ie:
$\somefilestopublish1\...
$\somefilestopublish2\...
$\somefilestoexclude1\...
$\somefilestoexclude2\...
Currently I have **\* as the contents argument which obviously will publish everything. I have tried appending ;-:<exclude_pattern> as suggested by a Google search but that just stopped all output and resulted in an empty folder.
Is there a way to use the minimatch expression to exclude folders or will I need to swap to explicitly selecting the folders to publish instead.
Minimatch use "!" to exclude the given pattern. You could specify it with following format:
!(somefilestoexclude1|somefilestoexclude2)
Following is the example:
With !(bin|obj), "bin" folder and "obj" folder under "WindowsFormsApplication1" folder are not copied to artifact.
!/$tf/** works for me. I've opted to shorten that to !/$*/**
http://www.globtester.com/ helped. The $ symbol doesn't have to be escaped despite conflicting guidance on msdn: https://msdn.microsoft.com/en-us/library/bb383819.aspx.
Suppose you want to collect all the *.nupkg files in your solution (for instance the ones you create during build) and copy them to another folder, but you want to exclude the ones you get through the package restore, you need to specify the following:
**\*.nupkg
!packages\**
It's important to specify them in this order. Placing the exclusion on the packages folder on top, will result in the Copy task copying all the *.nupkg files.
This worked for me for folder try this !**\Uploads***
For file **!(Web.config)
Above example is for excluding a folder and file available in same folder path.
On TFS 2017 Update 1 if you are using the Copy Files task and you want to copy all files from the $(Build.SourcesDirectory) but exclude the $tf folder what I found to work was the following.
In the Contents text box enter the following two lines.
**\*
!$tf\**
This post on social.msdn.microsoft.com is what helped me figure this out.

How can I efficiently get new directories with cvs?

If another developer adds a new directory to the CVS repository, I'd like my next update to bring this new directory into my working copy. Running cvs update doesn't do this. Running cvs update -d does, but it takes a helluva long time; it prints the pathname of every file in the repository and spends a little time thinking about each one. Running cvs update -d <dirname> in the new directory's parent does the job, but I have to know about the new directory first, and I have to do this for every new directory.
Is there an efficient way to get a complete update, including any newly-added directories, from a CVS server?
Use a shell script which generates a custom $CVSIGNORE list for this type of update, then runs cvsupdate -d to do this:
CVS has a list of files (or sh(1) file name patterns) that it should ignore while running update, import and release. This list is constructed in the following way.
The list is initialized to include certain file name patterns: names associated with CVS administration, or with other common source control systems; common names for patch files, object files, archive files, and editor backup files; and other names that are usually artifacts of assorted utilities. Currently, the default list of ignored file name patterns is:
RCS SCCS CVS CVS.adm
RCSLOG cvslog.*
tags TAGS
.make.state .nse_depinfo
*~ #* .#* ,* _$* *$
*.old *.bak *.BAK *.orig *.rej .del-*
*.a *.olb *.o *.obj *.so *.exe
*.Z *.elc *.ln
core
The per-repository list in ‘$CVSROOT/CVSROOT/cvsignore’ is appended to the list, if that file exists.
The per-user list in ‘.cvsignore’ in your home directory is appended to the list, if it exists.
Any entries in the environment variable $CVSIGNORE is appended to the list.
Any ‘-I’ options given to CVS is appended.
As CVS traverses through your directories, the contents of any ‘.cvsignore’ will be appended to the list. The patterns found in ‘.cvsignore’ are only valid for the directory that contains them, not for any sub-directories.
In any of the 5 places listed above, a single exclamation mark (‘!’) clears the ignore list. This can be used if you want to store any file which normally is ignored by CVS.
References
Ignoring files via cvsignore