I have played around with jenkins pipeline and like it a lot.
Our team has a project which follows structure described below
A -> B -> C
Debug Debug Debug
Release Release Release
Basically, project C depends on project B and project B depends on project A. When we mark A as a successful build, it has to pass both debug and release build. LKGB is marked as a project that does not break either debug or release build.
I wonder how can we translate this logic into pipeline code, building debug and release are more like "Sub Projects" since they run on different machine".
I tried using "parallel jobs" but it will make the debug/release output mixed together.
I tried out the "multi config" plugin and it serves our need, is there an equivalent version for jenkins pipeline?
Related
I have 2 builds (A & B), which create their own artifacts which are dropped into the $(Build.ArtifactStagingDirectory) and then published to 'Visual Studio Team Services/TFS'
Everything works fine for build A, but I am finding that when I am wanting to download an artifact from build B, that artifact cannot be found. When I look at the error message, I can see that TFS is actually looking for it from build A.
I dont want to point to a specific build number for build B, instead just want to point to the latest build of B.
Anyone know how I can update the reference so that TFS is looking at build B?
If I use the 'Download Artifact' Task, I can get this to work if I point to a 'Specific Build', but it does not work if I use the option 'Current Build'
Try below steps to achieve that:
Create 2 build definitions to queue Build A and B :
Build Definition A -- Build A
Build Definition B -- Build B
Create a release definition, add Build Definition A and Build Definition B as the artifacts source.
Trigger the release
Release works with multiple artifacts:
UPDATE1:
The Download Artifact task only works on single artifact, multiple artifacts doesn't work.
Besides, why you have to use the Download Artifact task? By default the release definition has enabled the Download Artifact, that means it will download the multiple artifacts automatically, then you just need to use the multiple artifacts directly in other tasks.
UPDATE2:
Since you already linked multiple artifacts in your release definition, that means you have to download them to use on subsequent Phases/tasks. But based on your description seems you want to use the Download Artifact task to down the latest version of one of them. That seems a bit contradictory for your requirements.
I can think of is that you can download the artifacts to a staging folder, then add copy task to copy the artifacts which you need in your phases.
Besides if you want to download all the latest artifacts, you can try this extension: Download Artifacts
In VSTS build and release, I am now trying to separate out my code compilation and testing into separate phases for a build plan.
The first phase is fine, it does a git clean and gets sources and all that. However, the second phase should just start executing after the first phase is done. Instead it runs the git clean and reset and get sources AGAIN. Why would a phase do this if it is part of one build? I cannot for the life of me figure out a way to turn this off.
It is also entirely possible that I am thinking about this incorrectly and should be doing testing in the release pipeline or something like that.
Anyway tl;dr How do I turn off the get sources for a secondary phase in a build
The get sources step and clean setting is independent of a specific agent phase. It's in the top of the build definition when you create a new one.
An agent phase is a way of defining a sequence of tasks that will run on one or more agents. At run time, one or more jobs are created to be run on agents that match the demands specified in the phase properties.
There is no such related setting in a configuration of agent phase. You could not turn off the get sources for a secondary phase in a build.
As a workaround, you could try to turn off the entire get sources step in the build definition, and directly use powershell script to do a get source in single agent phase. Detail steps please refer my reply in this question: Is it able to ignore/disable the first step Get source in vNext Build?
Moreover, about the concepts and features in agent phase, please refer this tutorial: Phases in Build and Release Management
I would like to access some files from source control (tfvc) while release management.
The sources I found are either build (type "Build") and the whole source tree (type "Team Foundation Version Control").
The type "Team Foundation Version Control" seems to match, but it is not allowed to select sub folder, e.g. "$/MyApp/branches/V2/scripts".
Do I need to create an artifact for the script files?
Instead of linking in a separate repository, I'd strongly recommend either publishing them as a build artifact (as the other answer mentions) or publishing them as a versioned NuGet package.
The reason is because everything that goes into a deployment should be versioned together. Scripts that are changing out of sync with everything else can cause abrupt deployment failures for unknown reasons. Let's say you linked those scripts in as an artifact and started a deployment along your pipeline from Dev -> Production. Dev deployment is fine. QA deployment is fine. Staging deployment is fine. Production deployment... fails? Because of an error in the scripts?
Whoops, someone committed a change to those scripts and introduced a bug. But the scripts weren't versioned, so you had no way of guaranteeing that the scripts being used in prior stages were the same as the scripts being used in your production stage.
You can save your source code as a artifact in your build process. Use the "Publish Artifact" step to publish your source code in Tfs or on a unc path. After that release management downloads your artifacts as the first step.
Something has managed to break on my TFS build. Whenever my deployment build is selected to a specific build, it shows the possible configurations (in my case dev1, dev2, test1, test2 and prd). However when I select <Latest> it disables the possible configurations. My deployment relies on this so it fails.
Where does TFS get these configurations for <Latest>? I'd have thought from the latest successful build. But this does have configurations when I select that specific build.
Any tips?
According to your information, guess you are using release management for the deployment.
If you select <Latest>, release management will catch the latest successful build of the build definition. It will ignored the failed build. Just as you guessed.
If you select <specific build>, then it will list the all successful build result of the build definition.
My current setup consists of:
Project job - it's the one, that fetches the sources, deploys to the test environment and runs tests across the test env
Building job - it's a job that runs on a special machine which builds the sources into deb packages.
The issue: it's fairly easy to retrieve the deb packages from building job back (as a job artifact), but how would I pass the sources from project job to a building one?
They run on a different jenkins slaves.
What are the possible options?
Note: the building job isn't a specific job for this particular project. Several projects use it as a helper to build deb from the sources, so I cannot hardcode anything project-specific there.
You want to look into the CloneWorkspace SCM Plugin
If you are using SVN, you might want to look at the Tracking SVN Plugin. This allows you to pull the same version out of SVN as another job. We use this so that we can create both a "debug" and "release" build from the same SVN revision. The debug version builds first. If it succeeds, the release version is built using the same revision that was built for the debug.