How to use remote paths in gitlab ci? - gitlab

I installed GithubHQ in one server and GitlabCI in another server. But now I need do integration between GitlabHQ and GitlabCI. When I go to add a new project in GitlabCI he requests a path .git project, but the project is on another server where the GitlabHQ.
I tried use the path remote, like: http://[domain-name]/[user]/[project].git but he not accept.
I researched about how GitlabCI search the path and found that it does not support remote paths. He use "Rugged::Repository.new(path)" just to get the project on the server.
Does anyone know a way to use paths .git remotes in GitlabCI?

As illustrated by Issue 36:
Actually the purpose of gitlab-ci implies that you install it on deployment point. You install it where you deploy your project
So you are supposed to use a local non-bare repo.
You could, in your case, clone your remote repo on the gitlab-ci server, and use that local path.
In order to build an integration between gitlab and gitlab-ci:
add gitlab_ci user to git group for read access
clone your project via git clone /home/git/repositories to somewhere like /home/gitlab_ci/projects/...
add this project to ci.
setup gitlabhq to use ci service
Thats all.
On gitlab push it will trigger gitlab ci to make git fetch origin, so testing repo will be always up to date.

Related

Add existing NodeJs (node, Express, monodb,...) project to existing a NX monorepo (Angular)

Has anyone experienced how to add an existing NodeJS API to an existing (Angular) Nx Monrepo?
Unfortunately the manual doesn´t help me so much
https://nx.dev/migration/manual
The process of migrating a repo into your mono repo requires a few manual steps. I think there would not be a simpler way to do it.
Assuming your node project does not share files with your current monorepo, this should be the steps:
on your node repo, create a branch 'to-monorepo' and in it, move all the files to folders that match the nx folder structure and push the commits to it.
remove your package.json file (we will later merge it with the monorepo's one)
once the folders match the nx folder structure, time to merge into the monorepo. From the monorepo add the remote of the other repo
git remote add node-repo <your git repo's node url>
at the monorepo folder, checkout your master
run a pull to make the node repo branches be available in the monorepo
git pull
create a new branch 'merging-node-repo' on your monorepo.
merge the branch node-repo/to-monorepo into your merging-node-repo branch, preserving the history:
git merge node-repo/to-monorepo --allow-unrelated-histories
push your new branch (all the code and its history will now be listed in this new branch)
remove the remote node-repo from your local monorepo configs
git remote rm node-repo
manually merge all the node repo's original package.json file dependencies into the monorepo's one, and run npm install from the monorepo. This way your package-lock.json file is updated. Once you are done, create a commit and push it.
this last step is more tricky. You have now to manually update the monorepo's config files to allow nx to start managing it. This is where the link you had in your question might help. Once you are done, create a commit and push it.
With these steps you can then merge your merging-node-repo branch into master.
I recommend you to create a separated nx workspace with a nodejs project on it. This helps you with having a baseline for all the necessary nx configurations and dependencies.
You might want to make sure your project works via nx commands from this separated workspace; this way you will have a better chance of getting configurations of your monorepo right.
Hopefully this gets you started.
Here is a solution that I wrote and used to import multiple repos into a single monorepo, under whatever subdirectories are wanted, while maintaining commit history:
https://github.com/marcuswestin/monorepo-merge
I've also found two other scripts that look like they might work, but I haven't tried them:
http://choly.ca/post/git-merge-to-monorepo/
https://github.com/ksindi/monoreaper

How do I merge Angular frontend and Node backend in one git repository?

I have an Angular frontend project in one repo and a local backend node project (currently not in a repo). I want to be able to work on both at the same time so having them in the same git repo would make it way easier to share changes.
My problem is I don't know which files need to move and which files can stay at the root. There are plenty of Angular, IDE, Node, and git files/folders and I have no idea where to start. I need to host both locally and eventually deploy.
Any tips on how to actually go about this? My current structure is below:
frontend
backend
If you want to store everything in one repository and still have git history of frontend app:
Create frontend folder in root of the frontend repository and move all folders and files into it besides .git folder and .gitignore file
Create backend folder in root of the frontend repository and paste there content of backend code files
In root of the repository git add everything and git commit all and git push it to repository

Changes not showing up in NodeJs/ReactJs apllication running on Heroku?

I have made changes to some css and js file in my Node-React apllication which is deployed on Heroku. But the changes are not showing up when I git add . the project on heroku. ALthough the changes are not coming up when I run the project locally.
Any help would be appreciated on what could be the possible cause on the changes not getting deployed?
You need a few more commands in your deployment workflow.
The git add . command is putting your local changes into staging.
You also need to run git commit -m 'your commit message' in order to commit those local changes to your local git repository.
Next, you need to run git push to push your local repository to the remote repository it is linked with.
Effective use of git is one of the most useful things you can teach yourself as a developer. It will enable you to contribute effectively to a team when the time comes. Here's a good starter article: Basic Git With Examples.

How to change a Netlify file after Build

Is it possible to change a file on Netlify after the site has already been built?
Example:
If I have a site:
https://physiome-test.netlify.com/simple_heart/ that accesses a file at
https://physiome-test.netlify.com/simple_heart/models/organsViewerModels/cardiovascular/heart/ecgAnimation.json
Is there any way that I can change this file without having to update my github repository?
Is there any way that I can change this file without having to update my github repository?
Using Netlify continuous deployment, which is what you are doing, you can't just change one file on Netlify without changing the files in your git repository that is tied to building your build process.
Process Netlify uses:
On commit trigger (webhook from GitHub) or a trigger deploy in the app.netlify.com admin
Checkout your target branch
Runs your build command
Compares your current build to existing CDN contents
Updates global CDN for changed files in your target deploy location
Changing Netlify Files without changing git
A new feature allows you to drag a deploy folder to app.netlify.com for fast review/deploy without using your git repository. Go to the Deploys tab of the site you want to update. You will see a message at the bottom like the pic below:
Drag your deploy folder to this location from your local system and your site will be updated with any new files on Netlify.
Note: All the files of your site must be in the folder with your current changes.
The netlify-cli can deploy directories without modifying a git repo.
Here is an example usage:
npm run build
netlify status
netlify deploy
and if everything looks good on your draft URL, take it live with the --prod flag.
netlify deploy --prod
Everything will update automatically.
Have you tried NetlifyCMS? https://www.netlifycms.org/
You can edit content on Netlify and it is integrated to Git workflow.

`git clone project2` in gitlab-ci.yml?

I'd like Gitlab CI to fetch source code of another project. Is there a better way than adding a read-only deploy key and setting it up in .gitlab-ci.yml?
You can also use GIT SUBMODULES within your project A to refer to project B and then add
GIT_SUBMODULE_STRATEGY: recursive
to the gitlab-ci.yml file in project A.
This also enables you to specifically include a specific branch or commit from your subproject.
https://docs.gitlab.com/ce/ci/git_submodules.html

Resources