balanced-cookbooks / balanced-ci

Internal configuration for the Jekins CI environment
4 stars 1 forks source link

Initial attempt #24

Closed mahmoudimus closed 10 years ago

mahmoudimus commented 10 years ago

Attempt to build a job on git commit. Chain all subsequents on a git tag using parameterized build plugin.

mahmoudimus commented 10 years ago
    <org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder plugin="conditional-buildstep@1.3.3">
      <condition class="org.jenkins_ci.plugins.run_condition.core.BooleanCondition" plugin="run-condition@1.0">
        <token>${ENV,var=&quot;HAS_GIT_TAG&quot;}</token>
      </condition>
      <buildStep class="hudson.plugins.parameterizedtrigger.TriggerBuilder" plugin="parameterized-trigger@2.22">
        <configs>
          <hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
            <configs>
              <hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
                <properties>PP_BUILD=${GIT_COMMIT}
PP_BRANCH=${GIT_BRANCH}
GIT_TAG=${GIT_TAG}
HAS_GIT_TAG=${HAS_GIT_TAG}</properties>
              </hudson.plugins.parameterizedtrigger.PredefinedBuildParameters>
            </configs>
            <projects>rump-quality</projects>
            <condition>ALWAYS</condition>
            <triggerWithNoParameters>false</triggerWithNoParameters>
            <block>
              <unstableThreshold>
                <name>UNSTABLE</name>
                <ordinal>1</ordinal>
                <color>YELLOW</color>
                <completeBuild>true</completeBuild>
              </unstableThreshold>
            </block>
            <buildAllNodesWithLabel>false</buildAllNodesWithLabel>
          </hudson.plugins.parameterizedtrigger.BlockableBuildTriggerConfig>
        </configs>
      </buildStep>
      <runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$DontRun" plugin="run-condition@1.0"/>
    </org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder>
mahmoudimus commented 10 years ago

ping @coderanger need your help integrating this into balanced-ci

mahmoudimus commented 10 years ago

Initial attempt:

  job 'test' do |new_resource|
    conditionally_continue do
      condition :boolean do
        token '${ENV, var="HAS_GIT_TAG"}'

        on :true do
          trigger 'rump-quality' do
            blocking true
            parameters do
              predefined true
              properties <<-EOF
                PP_BUILD=${GIT_COMMIT}
                PP_BRANCH=${GIT_BRANCH}
                GIT_TAG=${GIT_TAG}
                HAS_GIT_TAG=${HAS_GIT_TAG}
              EOF
            end
          end
        end

        on :false do
          stop
        end

      end
    end
  end
mahmoudimus commented 10 years ago

@mjallday has told me that i'm going about this all wrong, instead of focusing on a DSL, we should focus on template re-usability.

Given this mindset, I'm going to re-approach this problem.

mahmoudimus commented 10 years ago

ping @coderanger - ready to merge this.

mjallday commented 10 years ago

@mahmoudimus now that you've completed this change, do you still hold the same opinion that you had to do too much DSL specific work?