Create Gitlab-ci.yaml for build Java pipeline with Maven-JIB - gitlab

Our company work with Bamboo for create CI/CD pipeline.
but we can move from Bamboo to gitlab and i want convert all Bamboo Script in build stage and push stage (attached as images) to gitlab-ci file. could you please help me for this task ?
I want convert bamboo script to gitlab-ci

Related

Gitlab external job

I need to integrate security scans of my project files (SAST) in my Gitlab CI/CD pipeline, and it's easy to do with just another job in .gitlab-ci.yml, like:
security-scan:
stage: test
image: my_image:latest
script:
- scan run project/folder
But the problem is that developers can easily comment this part of the code and prevent the job run.
How can I create some kind of external job which will always be running by the trigger and developers would not be able to modify it?
I found this discussion on the Gitlab forum, but I don't get it.

Trigger Gitlab CI pipeline only when subproject pipelines are finished

I have 1 question regarding Gitlab pipeline triggering. We have multiple gitlab projects which trigger 1 common project. They are doing It separately. The idea is to trigger this project only when subprojects are finished. Is there are any way to do It better than create script which checks pipeline status via API? Because didn't find any out-of-the box solution for this
You can use the trigger:strategy. As per the docs:
Use trigger:strategy to force the trigger job to wait for the downstream pipeline to complete before it is marked as success.
So say you have build and test stages, and you want the trigger job in the build stage to succeed before moving on to the test stage, you could do something like this: =
downstream-build:
stage: build
trigger:
include: path/to/child-pipeline.yml
strategy: depend

how to add manual intervention in build pipeline

i have a build pipeline i want to add mannual intervention in the pipeline and when that manual intervention is done the user can click on resume the pipeline but i want to do this in build pipeline.
i checked in this https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/manual-validation?view=azure-devops&tabs=yaml but it looks like we need to do using stage pipeline in release pipeline. but i want this to happen in build pipeline
We seem have not such task for build pipeline, especially classic build pipeline.
If you want to add manual intervention in a build pipeline, you can try to set up this pipeline with YAML and add this run the Manual Validation task in an agentless job.
However, it might not be possible if you want to pause a running agent job in the build pipeline. Maybe you can try run the pipeline on a self-hosted agent with interactive mode.
[UPDATE]
You should use the Manual Validation task in an agentless job in the YAML pipeline, not in the classic build pipeline.
To set up an agentless job in the YAML pipeline, you need to set the value of 'pool' key to ne 'server'.
jobs:
- job: agentless-job
pool: server
To view more details, you can see "Server jobs".
To add a manual validation task in pipeline without creating a agent-less job you will need to define pool: server on the top of your steps. as below.
I got this from by referring to canary deployments but have tested the same works for rolling deployment and probably other steps introduced in the pipeline.
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/deployment-jobs?view=azure-devops
pool: server
steps:
- task: ManualValidation#0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
notifyUsers: |
youremailadress#hotmail.com
instructions: 'Please validate the build configuration and resume'
onTimeout: 'reject'

Continuous Deployment using gitlab

I am using gitlab in my local environment. Now I am trying to implement CI for autodeployment process. I followed the tutorial but that tutorial only works on gitlab.com my gitlab addrr is something like this http://192.168.-.-:---/root/test-project.
When I follow the tutorial step by step it works on gitlab.com that means when I add .gitlab-ci.yml file to my root project it triggers the pipeline. But when I add .gitlab-ci.yml file on my local git it doesn't trigger the pipeline as pipeline page shows everytime getting started with pipeline and it seems like i am not pushing it right.
How can I add .yml into my root directory?
the first step is to make pipelines work. I am confused
This should be easier with GitLab 13.12 (May 2021), which does now include a tutorial:
Useful GitLab CI/CD information in the pipeline editor
Creating your first GitLab CI/CD pipeline can be difficult, especially for those new to CI/CD.
You might spend time switching back and forth between documentation and GitLab to get your first pipeline configured.
In this release we’ve added a drawer with useful information to the pipeline editor to help guide you through the steps of writing your first pipeline.
See Documentation and Issue.

How to trigger automatic build in gitlab CI on commit to non-default branch?

I have a project in GitLab that is integrated with Gitlab CI. Every push to master shedules a build of the project.
However, when a new branch is created and pushed into repository, build is not sheduled in gitlab CI. What are the settings for enabling build of other branches - alterativaly, how can i figure out what went wrong?
how can i figure out what went wrong?
Analyse .gitlab-ci.yml. Take a look at this, I would take a wild guess that you have limited your job execution with:
...
only:
- master
...

Resources