I'm migrating form Jenkins to Gitlab CI (self-hosted) and try to setup a workflow for all projects. One project is a Golang tool whose binary is required in other projects.
I've setup a working pipeline for the Golang project which builds a release with an attached binary for download. How can I reuse that binary in other project pipelines? Is there a way to download the binary with the REST API of Gitlab, or can I reuse the artifact of the release job in the other pipelines? I've searched the documentation of Gitlab and did not find an elegant solution for this yet :-/
I've found a solution now. It's possible to use curl to download the build artifact for reuse
curl -L --header "PRIVATE-TOKEN: <TOKEN>" "https://<HOSTNAME>/api/v4/projects/<PROJECT_ID>/jobs/artifacts/master/raw/<ARTIFACT_PATH>?job=build" --output <BINARY_NAME>
Related
I want to pass multiple job name to Manen script to deploy the job on TMC and we are using Gitlab for that.
I can able to do that for single job with below command.
- mvn -s $MAVEN_SETTINGS -U -f ${CI_PROJECT_DIR}/CICD_TEST/poms/pom.xml -Pcloud-publisher clean deploy -fn -e -pl jobs/process/cicd_test_2_0.1 -am
I want to deploy cicd_test_3_0.1 as well
How we can pass multiple jobs name ?
Thanks,
Shantanu K
You can pass multiple jobs to be built / published:
-pl jobs/process/cicd_test_2_0.1
-pl jobs/process/cicd_test_2_0.1,cicd_test_3_0.1
Instead of -fn I'd suggest using -fae (fail-at-end)
You can find more information in the official docs: https://help.talend.com/r/en-US/7.3/software-dev-lifecycle-best-practices-guide/ci-mvn-options
Also as a best practice, try to do the generateAllPoms in advance of the build. And make sure you're running the same or newer patch in your CI.
And since you're asking help for TMC, I'd suggest checking out http://community.talend.com and getting touch with Talend Support for similar questions.
Is there any task or something which will send the release pipeline data to git repo instead of sending it to any evironment?
You need to use the Invoke HTTP REST API task to call github api and create a file there.
No, there is not.
The only way you could do is running git commands in a release to git push files/data.
How to do this, you could refer below links:
Executing git commands inside a build job in Visual Studio Team Services (was VSO)
Run Git commands in a script
I have a private repo and want to publish the build artifacts to another public repo (it's the packaged application)
How can I do that in jenkins? I could only find publish on the git I've used to build.
Thanks
There are multiple ways to do this:
- Using a shell script that calls the GIT command line tool. This can be a post-build script, the same script compiling the code, etc.
- Same thing in groovy
- Call a downstream job to do that for you (probably the best solution IMHO)
The main problem would be the GIT credentials, but that is not an big issue...
In my team we have GitBlit like version control system, and we are interested by GitLab CICD plugins.
If convinced, in the future we could import alls projects but for the moment i would like to use GitlabCI keeping GitBlit like source control.
Is it possible ?
I try the "import project" functionnality but it create a new repository in Gitlab and cut the relation with GitBlit.
Thanks in advance
Your CI definition (.gitlab-ci.yml) is located in a Gitlab repository and is executed when you commit / push to that repository, so in order to really test and experience the full potential of, in my opinion, the awesome CI abilities of Gitlab you should just migrate a repo.
On the other hand I do understand that is not always so easy, so I also have an alternative for you (this is however, advanced usage):
Create a Gitlab repo with only a .gitlab-ci.yml file to define the build-steps you want to execute
Add a git clone <your GitBlit repo url> . command to your .gitlab-ci.yml's before_script to get your GitBlit code in a Gitlab CI job
Use triggers to run the pipeline when something is pushed to GitBlit by adding a hook in GitBlit that sends a POST request to Gitlab
EDIT based on comment:
A POST-request will look like this:
curl --request POST \
--form token=TOKEN \
--form ref=master \
https://myGitlab/api/v4/projects/1/trigger/pipeline
I have gitlab server setup on my system. It is working fine with single git repositories. Now I want to push complete android source with all .git projects to this server. How to do that? Do I have to push all project individually?
I have the same problem, managing different AOSP releases for our hardware.
Please note that I choose not to have ALL AOSP repositories in our GitLab instance, but only the one that need customization. The other are cloned directly from google git (or local repo mirror to speed up clone).
What I did is having a group (aosp) for general purpose repository that might apply to different project. Having a custom group for a given AOSP customization, where I usually place only device/xxx sources and repo manifest.
The most annoying task here is to setup the aosp group with, usually 50 repositories. Here is what I did:
start from the standard AOSP source (repo init../repo sync)
apply patches from silicon vendor, add any new repos (usually you have at lease some device/yourbranch/yourdevice). Add this patches as new branches (so repo list works with my scripts)
with a couple of grep/awk parse repo list output to get changed repos
for those repo, with a couple of other scripts and a bit of python gitlab commands, create the project on your server
My script can be found in my gitlab project. You might need to adapt them to you own AOSP version.
HTH,
Andrea
You can try (3 years later) the latest GitLab 11.2 (August 22nd, 2018).
See "Support for Android project import":
Until now, importing complex project structures with multiple sub-structures was a tedious, time-consuming task.
With this release, we introduce support for manifest files for project imports.
A manifest XML file contains metadata for groups of repositories, allowing you to import larger project structures with multiple repositories in one go.
When creating a new project, there is a new option to choose a “Manifest file” as source of your project import on the “Import project” tab.
In addition, you can select from the list of individual projects in a subsequent step if you don’t want to import the complete project structure.
This improvement allows you to import the Android OS code from the Android Open Source Project (AOSP), as one exciting use case. You can also import other projects that use manifest files which meet our format requirements.
See issue.
See documentation.
Here's what I've found. In short, I don't think its viable to use gitlab to help host an aosp mirror.
My test was to use premade docker containers and try the website out.
(from: https://github.com/sameersbn/docker-gitlab )
What I found was that just like (bitbucket or github) you create a project that is tied to a single git. -- You would have to create a project for all
Step 1. Launch a postgresql container
docker run --name gitlab-postgresql -d \
--env 'DB_NAME=gitlabhq_production' \
--env 'DB_USER=gitlab' --env 'DB_PASS=password' \
--volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
quay.io/sameersbn/postgresql:9.4-5
Step 2. Launch a redis container
docker run --name gitlab-redis -d \
--volume /srv/docker/gitlab/redis:/var/lib/redis \
quay.io/sameersbn/redis:latest
Step 3. Launch the gitlab container
docker run --name gitlab -d \
--link gitlab-postgresql:postgresql --link gitlab-redis:redisio \
--publish 10022:22 --publish 10080:80 \
--env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' \
--env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \
--volume /srv/docker/gitlab/gitlab:/home/git/data \
quay.io/sameersbn/gitlab:8.0.5