Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stage to import image and automatically import if possible #400

Merged

Conversation

michaelsauter
Copy link
Member

  • New stage odsComponentStageImportOpenShiftImage.
  • New "special" stage odsComponentStageImportOpenShiftImageOrElse
    which either imports an image or executes the given closure.
  • Images are now tagged with the short Git SHA, dropping the Jenkins
    build number prefix.

Example usage:

@Library('ods-jenkins-shared-library@3.x') _

odsComponentPipeline(
  imageStreamTag: 'ods/jenkins-agent-golang:3.x',
  branchToEnvironmentMapping: [
    'develop': 'dev',
    'release/*': 'test',
    'master': 'prod'
  ]
) { context ->
  odsComponentStageImportOpenShiftImageOrElse(context) {
    stage('Build') {
      // custom stage
    }
    odsComponentStageScanWithSonar(context)
    odsComponentStageBuildOpenShiftImage(context)
  }
  odsComponentStageRolloutOpenShiftDeployment(context)
}

This allows users exactly which steps to skip when an image can be imported. Further, it allows to use the "import image stage" as a standalone feature as well.

@michaelsauter michaelsauter added the enhancement New feature or request label Jul 3, 2020
@michaelsauter michaelsauter self-assigned this Jul 3, 2020
@michaelsauter michaelsauter added this to In Progress in OpenDevStack 3.0 via automation Jul 3, 2020
@michaelsauter michaelsauter force-pushed the feature/promote-images branch 2 times, most recently from 2d019fe to e467413 Compare July 3, 2020 14:18
clemensutschig
clemensutschig previously approved these changes Jul 3, 2020
Copy link
Member

@clemensutschig clemensutschig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is amazing @michaelsauter

One small comment though - I am wondering if this would not break MRO - if MRO expects to build an image - and in reality it's not built ... or deployed, or ....

@henrjk
Copy link
Member

henrjk commented Jul 3, 2020

Awesome addition!

I don't have time to look into reviewing this in depth.

However I did not see any issues on a cursory review.

@michaelsauter
Copy link
Member Author

@clemensutschig I thought about this, and decided that as a first step, we just disable the functionality when in an orchestration context (see https://github.com/opendevstack/ods-jenkins-shared-library/pull/400/files#diff-c50f3cdbc0d4a66242907069707b7463R17-R23). Maybe this is even a long-term solution, as the orchestration pipeline has its own logic to bypass building a component altogether.

* New stage `odsComponentStageImportOpenShiftImage`.
* New "special" stage `odsComponentStageImportOpenShiftImageOrElse`
  which either imports an image or executes the given closure.
* Images are now tagged with the short Git SHA, dropping the Jenkins
  build number prefix.
Copy link
Member

@gerardcl gerardcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!!!
also loving the push for ff merge!

@michaelsauter michaelsauter merged commit 108e0d8 into opendevstack:master Jul 7, 2020
OpenDevStack 3.0 automation moved this from In Progress to Done Jul 7, 2020
@michaelsauter michaelsauter deleted the feature/promote-images branch July 7, 2020 08:57
michaelsauter added a commit to BIX-Digital/ods-quickstarters that referenced this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement New feature or request
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants