How do I give permissions to update/init private submodules in Travis CI build? - travis-ci

I added a private submodule to my Travis CI build. During the build when it tries to update the submodule from the private repo, I get the following error.
The command "eval git submodule update --init --recursive " failed.
I am assuming the problem is that it won't allow access to the private submodule. I was looking here: https://docs.travis-ci.com/user/private-dependencies/#dedicated-user-account
I tried to generate SSH keys and RSA private keys, but I don't know where they should be stored?
I think I have to generate new keys and store them on travis, but I'm not sure where.
Has anyone used private submodules in Travis CI builds?
Thanks.

Related

Bitbucket token using in bitbucket pipelines (Authentification issue)

i am trying to run pipeline on bitbucket, for my nodejs app, and i have some issue on deployment step (aws ec2). Pipeline runs in container, ssh-ing to my instance on aws, and then try to git clone my app, by command
git clone https://my_bitbucketusername:my_bitbuckettoken#bitbucket.org/somevendor/somerepo
but it is not good option to provide token in script, so i tried to set token as repository variable like $BITBUCKET_TOKEN,
git clone https://my_bitbucketusername:$BITBUCKET_TOKEN#bitbucket.org/somevendor/somerepo
but then i faced with bitbucket failed authentification. Same issue on gitlab, whad i do wrong?

Jenkins failing to clone Bitbucket links during Rspec Puppet unit tests

I'm trying to set up a Jenkins build to clone a Bitbucket link and run unit tests I've written against some Puppet modules. I've got Jenkins set up with an SSH keypair and have verified that it can clone the Bitbucket repository initially, but when the unit tests run and clone separate modules as part of the test, I get an error that the public key does not work.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I've verified that the build is running under the Jenkins user and that the keys are in the .ssh directory, what else can I try to fix it?
I was able to fix it by logging into the Jenkins Docker instance and using the SSH keypair from there instead of the one on the Jenkins server hosting the instance. It worked completely after I did this.

CircleCI 2.0 SSH debug: Failed to enable SSH, No SSH key is found

Config:
CircleCI 2.0
Bitbucket private repo
After I click on "Rebuild with SSH", the "Enable SSH" section outputs
Failed to enable SSH
No SSH key is found. Please make sure you've
added at least one SSH key in your VCS account.
What does this mean? How do I fix this?
You can use your personal private public id_rsa id_rsa.pub key-pair (which you may already generated to SSH access to other machines)
just add your public key ~./ssh/id_rsa.pub to Bitbucket -> Settings -> SSH keys -> add SSH key
then go to CircleCI and rebuild the project.
There may be confusion because CircleCi uses other SSH key called checkout SSH key-pair for:
checking out the main project
checking out any Bitbucket-hosted submodules
checking out any Bitbucket-hosted private dependencies
automatic git merging/tagging/etc.
Private checkout SSH key is saved on circleCi servers and public key is automatically uploaded to Bitbucket.
If you're using Github:
go to your keys setting: https://github.com/settings/keys
generate a key pair if you don't have one
copy and paste the key in the CircleCI UI and save.
You should immediately be able to log in with SSH into the CircleCI now (run rerun job with SSH).
If you're using Bitbucket:
Add your public key to your bitbucket account: choose Bitbucket settings from your avatar in the lower left
Click ssh keys and add your public key
You don't need to do anything in CircleCI, simply re-run the job using SSH
sources:
https://confluence.atlassian.com/bitbucket/troubleshoot-ssh-issues-271943403.html

Uploading projects from local computer to server by using Gitlab

I am completely new to Gitlab because previously I upload project to server using Filezilla. But now I have finished my Laravel projects in my local computer, and I would like to upload it to my could hosting. Currently my project is stored in c:\\xampp\htdocs\myproject.
Please tell me command line step-by-step to achieve this? I am using Putty on window. I can't understand it by reading existing tutorial.
I use DigitalOcean.com's server and yes I registered on gitlab.com to store/upload my project.
As a first approach, you can push directly to DigitalOcean, as describe in this tutorial:
clone your GitLab repo as a bare repo on your DigitalOcean instance (VPS: Virtual Private Server or Droplet)
cd
git clone --bare https://gitlab.com/<yourUsername>/<yourRepo.git>
add a post-receive hook similar to this auto-deploy article
That is:
cat > /home/rails/rails_project.git/hooks/post-receive
(Copy-paste the following lines)
#!/bin/sh
echo "-----------------------------------"
echo "Post receive hook: Updating website"
export GIT_WORK_TREE=/path/to/yourProject
export GIT_DIR=/home/yourUser/yourRepo.git
cd $GIT_WORK_TREE
git pull
git checkout master -f
(type Ctrl+D to exit)
Depending on your deployment path, you might have to execute the git commands as root, but it is best if you can keep your deployment as your username and not root.
But if you don't want to push to DigitalOcean, only to GitLab, you can use instead Git-Auto-Deploy.
Then you can push to GitLab, and that will trigger a deployment to your VPS.
When commits are pushed to your Git repository, the Git server will notify Git-Auto-Deploy by sending a HTTP POST request with a JSON body to a pre configured URL (your-host:8001).
The JSON body contains detailed information about the repository and what event that triggered the request.
Git-Auto-Deploy parses and validates the request, and if all goes well it issues a git pull.
Additionally, Git-Auto-Deploy can be configured to execute a shell command upon each successful git pull, which can be used to trigger custom build actions or test scripts.

Dockerhub automated build: BitBucket repository with private submodules

I have a private BitBucket repository that stores my Dockerfile. This repository has two other private BitBucket repositories as git submodules. I setup an automated build process on Docker hub and added the public SSH key to my three private repositories on BitBucket. However, when the build runs, it successfully connects to the main private repository on BitBucket but fails when trying to get the submodules. I see the following error in the log file:
fatal: could not read Username for 'https://bitbucket.org': No such device or address
It seems like the build agent is trying to access the submodules via HTTPS, and obviously, fails as there is no web access setup.
Am I missing something or is it a limitation that I'll have to live with for the moment?
I figured it out. My .gitmodules had an HTTPS URL for that particular repository. I edited the .gitmodules file and changed the URL to SSH. Seems like it is building now :-)

Resources