Continuous jenkins delivery with shared workspace

Reference Information:

We have one Jenkins assignment ( Production ) to build delivery every night. We have another work ( ProductionPush ), which the next day pushes the machines delivered by the proprietary protocol to the production machines. This is due to the fact that some production machines are only available at certain hours during the day (this also gives us the opportunity to fix any breaks at the last minute). ProductionPush needs access to the delivery created by the Production task (therefore, it needs access to the same workspace). We have several nodes and parallel assemblies (and therefore unpredictable workspaces), and prefer not to associate jobs with the fixed node / workspace, as resources are somewhat limited.

Questions:

  • How to make sure that both jobs share the same workspace and ensure that ProductionPush runs at a fixed time the next day only if Production succeeds - without fixing both jobs to run from the same node / workstation? I know that a Parameterized Trigger Plugin can help with some of this, but it does not seem to have the ability to delay time, and 12 hours seems too long for a quiet period.

  • Sharing a workspace a bad idea?

+7
source share
2 answers

Answer 2: Yes, sharing a workspace is a bad idea. There is the possibility of blocking files. There is a problem with deleting the workspace. Just don't do it ...

Answer 1: you need to Archive assembly artifacts. Thus, artifacts for a particular assembly (by assembly number) will always be available, regardless of whether another assembly is working or not, or in what state the workspaces are in

To archive artifacts

  • In your build job, under Post-Build Actions, select Archive Artifacts
  • Specify artifacts for archiving (you can use a combination below)
    a) You can archive everything: *.*
    b) You can archive a specific file using wildcards: /path/to/file_version*.zip
    c) You can ignore intermediate directories, for example: **/file_version*.zip
  • To avoid storage problems with many artifacts, at the top of the configuration you can select Discard old assemblies , click the Advanced button and play with the days to save artifacts and the Maximum number of lines for storing artifacts. Please note that these two settings do not determine how long the actual assemblies last (other settings control this)

To access Jenkins artifacts

  • In the assembly history, select any previous assembly that you want.
  • In addition to the changes and changes to SCM, you will now have an Artifact Assembly link in which you will find all artifacts for that particular assembly.
  • You can also access them with Jenkins permalinks, for example, http://JENKINS_URL/job/JOB_NAME/lastSuccessfulBuild/artifact/ , and then the name of the artifact.

To access artifacts from another quest

I explained in detail how to access previous artifacts from another deployment job (in your ProductionPush example) here:
How to promote a specific build number from another job in Jenkins?

If your requirements always include the latest build for production, you can skip the promotion setting at the above link. Just follow the steps to set up your deployment job. If you have a deployment task, if it always runs at the same time, just configure the Build periodically . In addition, you may have another task that will run the deployment task based on any conditions that you want.

In any case, above, if the Default Selector parameter is set to Last successful build (as described in the link above), the last build will be transferred to Production

+25
source

Incorrect archiving of artifacts is a really good idea. An intermediate repository might be better because it allows cross-functional teams to share artifacts between different assemblies when needed by customizing the Maven settings.xml settings file.

You really want to deploy (ear / war) as a thing that will be built, tested, and then advancing to production as soon as confidence is high during assembly.

Use the build number for your deployable (major.minor.buildnumber). This is what you advertise for production, and you can rely on your tests. Do not use a hyphen to separate the minor with the build number, as this causes Maven to perform lexical comparisons ... a decimal point will force a numerical comparison, which will give you much less headaches.

In addition, you did not specify your target platform, but using the Maven APT / RPM plugin to direct APT / RPM to the APT / YUM relay available for the production box (AFTER successful testing!) Will it be good by industry standards?

0
source