简体   繁体   中英

Similar to Jenkins Groovy file. Is there Any file for Bamboo?

Im totally new to this Devops field basically for Jenkins, Groovy file is used to maintain preparation-build-Deploy, Similarly for Bamboo which script is used?

I got to know bamboo plan is used. But how the plan is generated though any script or any file.

And i have pipeline for Jenkins similarly how it can be done for Bamboo plan.

the groovy file for Jenkins is

node {
    stage('Preparation') { // for display purposes
        // Get EDM code from a GitHub repository
        cleanWs()
        checkout scm
        sh "python $WORKSPACE/common/deployment_scripts/abc.py --localFolder $WORKSPACE --env dev"
    }
    stage('Build') {
        // Run the maven build
        sh "mvn clean install -f $WORKSPACE/pom.xml -Dmaven.test.skip=true"
    }
    stage('Deploy') {
        //Run the deployment script
        sh "python $WORKSPACE/common/deployment_scripts/ase.py $WORKSPACE lm-edm-builds-ndev ${env.BUILD_NUMBER} dev"
        sh "python $WORKSPACE/common/deployment_scripts/qwert.py --JsonParameterFile $WORKSPACE/common/deployment_scripts/my_properties.json --BuildVersion ${env.BUILD_NUMBER} --WorkSpace $WORKSPACE --environment dev"
    }
}


For Bamboo, you can do so with Bamboo Specs. The Bamboo Specs allows you to define Bamboo configuration as code, and have corresponding plans/deployments created or updated automatically in Bamboo. Read more about the Bamboo Specs here .

Bamboo Specs recognize two ways of creating plans, with Java or YAML. Select the one that matches your needs best. The syntax for both can be found in their official reference documentation .

A sample YAML Specs to define a plan can look like below as detailed in this page :

---
version: 2
plan:
  project-key: MARS
  key: ROCKET
  name: Build the rockets

# List of plan's stages and jobs
stages:
  - Build the rocket stage:
    - Build

#Job definition
Build:
  tasks:
    - script:
        - mkdir -p falcon/red
        - echo wings > falcon/red/wings
        - sleep 1
        - echo 'Built it'
    - test-parser:
        type: junit
        test-results: '**/junit/*.xml' 
  # Job's requirements
  requirements:
     - isRocketFuel
  # Job's artifacts. Artifacts are shared by default.
  artifacts:
     - name: Red rocket built
       pattern: falcon/red/wings

You may start with this tutorial for Creating a simple plan with Bamboo Java Specs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM