How to checkout multiple repos in single jenkins workspace - jenkins-pipeline

How to checkout multiple repos in single jenkins workspace. I am using SVN as my scm

If you want to make a different folder for different repositories inside single workspace, you can use ws(yourlocalfolderpath){ checkout{} } for every repository you want to checkout.
Here, yourlocalfolderpath should be the folder name you want to create inside your single workspace. Like this, you can create folders for multiple repos in a single workspace.

Related

Jenkins Creates Random Folders In Workspace

I have a windows Jenkins server, and in some jobs, Jenkins is creating random folders in the ws#script folder and puts the checked-out repo inside of them. This skews jobs as I am unable to target files in the repo's folder.
If I delete the folder, it gets generated using a different name in the next checkout. I found a few articles online but they are all old and not relevant anymore.
example: ProjectName\ws#script\e5a1a87afa81141b22dc42f9e6af441b7f7353d397659b1911e6e150675b9e34\checkedOutRepo
It will be great if anyone can help with this.

Differentiate between two instances of the same repository using Github Actions by deploying them to different folders

Due to the relative simplicity of our site and limited resources, we're using one machine as both our development and staging server using a self-hosted github runner. It connects via SSH and runs actions triggered by pushes to two different branches. What I'd like to do is have two github actions scripts execute for two different branches of the same repository, we'll call them dev and stable for repository projectA. dev would deploy to ~/actions_runner/_work/projectA/projectA-dev and stable to ~/actions_runner/_work/projectA/projectA-stable, then use individual ENV files to connect them to the appropriate versions of their support services. It's unclear how to configure each script to rename the directory for their branch. Currently, the development workflow (a single script) deploys to ~/actions_runner/_work/projectA/projectA automatically... it seems like it should be possible to change the second instance of the repository name in the path to something more customized. Is it?
I looked at the github actions documentation about deploying to specific locations and haven't seen anything. I also searched github, reddit and google. Nothing I've found has helped! Thanks in advance.
It's unclear how to configure each script to rename the directory for their branch
Ideally, you do not rename anything, but use each action to checkout in your runner workspace to two different paths.
That way, you can use projectA-dev/stable in each action.
- name: Checkout tools repo
uses: actions/checkout#v3
with:
repository: my-repo
path: projectA-dev

Synchronizing github repo on two different servers

I created a github repo for some scripts I use in order to keep from having to remote into the server every time I want to make a change.
This code needs to exist simultaneously on two different servers, and one of the servers doesn't need all of the files that the other one does.
Is it possible for me to sync a repo over two different servers each having their own gitignore files?
It's possible to have different exclude information on both servers [1]. However with that said, this won't stop a pushed file from being downloaded on the server that has that file excluded. There is no way to stop git from pulling all files when you pull.
You would need to have two repositories if you have different files, or use some sort of submodule approach for shared files (repoA and repoB go to serverA and serverB, and both include a shared submodule repoShared) - but this is now really pushing what is already a non-ideal use case for git.
[1]:
Git stores exclude information in $GIT_DIR/info/exclude (where $GIT_DIR is your .git folder within you repository), so you could hardcode relevant files in there.
Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:
git update-index --assume-unchanged [<file>...]
See the relevant documentation, or previous posts on similar matter.

Laravel projects under git-versioning with same base project

I'm developing with Laravel a suite of applications which are very different from each other, but must have the same base (graphics-functions-components-login-ecc.).
I just finished the base project, which I simply called 'template', and which is under git-versioning.
Now I have to develop the real applications, which will be extensions of 'template', but I want to keep pulling the base from 'template' and create some sort of 'git extension' for each application.
I would like to do this to keep the laravel tree structure of the project (so not use external folders) while avoiding to update each single application when I modify the 'template'.
I thought about link the same project folder to two different repositories (template+extension), using 'gitignore' to manage which file links to which repository, but I think it could be troublesome in case of new file added or so.
Maybe git has already an existing way to solve this, but I'm quite new and not expert to this, so I hope you'll guide me to the light.
You can use git Submodules. Submodules are Git repositories nested inside a parent Git repository at a specific path in the parent repository’s working directory. For detail visit https://git-scm.com/docs/git-submodule.

Two Different CVS servers (remote and local) for one project (CVSNT, WinCVS client)

There is a project that uses CVSNT/WinCVS for Version Control. This is the central repository. Locally checked out folders contain hidden sub-folder called "CVS".
I tried to install CVSNT server locally and use second instance of WinCVS to manage(version control) local temporary changes before committing to the central repository.
But that is not working because when checking out from the second(local) repository it still uses "CVS" sub-folder name for its working files.
Anybody knows if it is possible to configure CVSNT server and/or Client to use different name for this sub-folder? And if yes, how?
So far I'm using TortoiseSVN. It creates folders too, but they called ".svn" so there is no interference. It is integrated in Windows shell, which I don't like.
A sandbox is tied to a given repository (which is regitered in one of the files in the hidden CVS folders). You can't use the same sandbox to commit locally and remote (are you tring to mimic a DVCS? Use one of them if you need them). You can't change the folder name (but changing the CVS source files...), but beware WInCVS use them as well because they contains informations about the files status.
You have two options:
The CVS way: create your own development branch, commit to that, merge with the main branch when your code is ready. Of course the CVS server has to be reachable all the time.
The DIY way: create two sandbox, one from the local repository, one from the remote one, move files between them as you need. This is a more error prone way, IMHO.
Of course you can try to use two different VCS, but you will end up with a lot of headaches then. Better to use Git, Mercurial or the like that do what you need without any special configuration.

Resources