Code Monkey home page Code Monkey logo

retain-release's Introduction

Retain indefinitely current release

Build Status

Overview

As a common practice, after a successful release to production, often there is a need retain the involved artifact and relevant release information for certain amount of time. In order to avoid that a retention policy removes this information, you will mark that release with a Retain indefinitely flag, by choosing that option from the VSTS UI. As this is a manual process, with this task I'm trying to automate this, in a form of task that can be used in your release, to set the Retain indefinitely flag for the running release.

Requirements

The only requirement is that the account on which the build agent is running has sufficient privileges to set Retain indefinitely flag. In case the permissions are missing, a similar error will be visible in the log

##[error]VS402904: Access denied: User Project Collection Build Service (mummy) does not have manage releases permission. Contact your release manager.

Edit the security settings for that particular release or for all the releases and set the following to the needed account.

Replace Tokens parameters

Make sure 'Manage Releases' permission is granted for the indicated user.

Parameters

Only a single parameter is presented by the task in a form of a checkbox labeled Mark the current release to be retained indefinitely. By default is set to true. If checked, it will mark the current release with Retain indefinitely flag. Otherwise it will take the Retain indefinitely flag off the current release.

Remarks

From the major version 3 is now possible to use the task in your YAML pipeline definition to set the retention over your multistage pipeline.

Release notes

  • 3.1.0 - Moved to Node16 handler and updated dependencies
  • 3.0.0 - Added support for multistage pipelines (builds). Updated libraries. #1
  • 2.0.4 - Node Js handler implementation #1
  • 1.1.x - Initial implementation based on PS3 handler

Contributing

Feel free to notify any issue in the issues section of this GitHub repository. In order to build this task, you will need Node.js and gulp installed. Once cloned the repository, just run 'npm install' then 'gulp package' and in the newly created folder called _packages you will find a new version of the extension.

retain-release's People

Contributors

azure-pipelines[bot] avatar mmajcica avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

retain-release's Issues

Retain associated build artifacts also

Hi Mario,

your extension is great. But please provide an option to retain the associated artifacts also. I wrote a PowerShell script for TFS2015 which did the trick for me. Unfortunately it doesn't work on VSTS. But that's how it could work:

$keepforever = @{ keepforever='true' }

$jsonKeepForever = $keepforever | ConvertTo-Json

$uriForBuildUpdate = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$($env:SYSTEM_TEAMPROJECTID)/_apis/build/builds/$($env:BUILD_BUILDID)?api-version=2.0"

Invoke-RestMethod -UseDefaultCredentials -Uri $uriForBuildUpdate -Method Patch -Body $jsonKeepForever -ContentType "application/json"

The trick was that $env:BUILD_BUILDID pointed to the associated artifact during Release phase also so this worked.

Thanks you very much in advance.

unable to get local issuer certificate

We have configured https for tfs 2018 on premise. its ssl certificate is local. so when running this task we get the following error message:
"unable to get local issuer certificate"

Request: cross platform support

I love the functionality provided by this extension. It's something we've been doing manually for a while so the capability will be great for us. However, the current Powershell implementation can only be executed on a Windows-based agent.

Would you consider adding a Node.js implementation of this task which the VSTS agent could run on any platform, regardless of OS?

ADO permissions have changed?

Getting this error again: VS402904: Access denied: User Project Collection Build Service (xxxxxxxxx) does not have manage releases permission. Contact your release manager.

But 'manage releases' is no longer an option to enable. The options are now:
Bypass policies when completing pull requests
Bypass policies when pushing
Contribute
Contribute to pull requests
Create branch
Create repository
Create tag
Delete repository
Edit policies
Force push (rewrite history, delete branches and tags)
Manage notes
Manage permissions
Read
Remove others' locks
Rename repository

Please advise.
Thanks

Option: Also retain the run of the CI pipeline which the retained run of the CD pipeline depends on

When a release pipeline run is retained, Azure DevOps automatically retains the run of the build pipeline that is used by the release.
Similarly, we can now have a multistage CD pipeline which is triggered by a distinct CI pipeline, and which deploys artifacts produced by this CI pipeline.
If would be awesome to have an option for retaining as well the run of the CI pipeline when the task is executed in the CD pipeline.
The task would just need the CI pipeline resource alias as an input, allowing to get the CI pipeline project, id, and run id with these predefined variables:

  • resources.pipeline.<Alias>.projectID
  • resources.pipeline.<Alias>.pipelineID
  • resources.pipeline.<Alias>.runID

Task no longer works; gives 404 error

It seems this task stopped working sometime in 2019. It used to work last year, but this year anytime we've tried to use it we get a 404 error. Here's the task output:

2019-10-31T15:19:01.9841463Z ##[section]Starting: Retain the Build and Release forever
2019-10-31T15:19:01.9933339Z ==============================================================================
2019-10-31T15:19:01.9933431Z Task         : Set Retention forever on a Build Release
2019-10-31T15:19:01.9933509Z Description  : Set Retention forever on a Build Release
2019-10-31T15:19:01.9933566Z Version      : 1.0.10
2019-10-31T15:19:01.9933639Z Author       : Haribabu, Bavanari
2019-10-31T15:19:01.9933707Z Help         : 
2019-10-31T15:19:01.9933778Z ==============================================================================
2019-10-31T15:19:01.9937961Z ##[warning]Task 'RetentionTask' (1.0.10) is using deprecated task execution handler. The task should use the supported task-lib: https://aka.ms/tasklib
2019-10-31T15:19:01.9938653Z Preparing task execution handler.
2019-10-31T15:19:02.1379607Z Executing the powershell script: C:\Builds\_work\_tasks\RetentionTask_7b42ca94-dc22-43dd-8b65-fcbf854b6b78\1.0.10\BuildReleaseRetentionTask.ps1
2019-10-31T15:19:02.8215956Z ##[error]System.Net.WebException: The remote server returned an error: (404) Not Found.
2019-10-31T15:19:02.8216391Z    at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
2019-10-31T15:19:02.8216542Z    at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
2019-10-31T15:19:02.8381381Z ##[error]PowerShell script completed with 1 errors.
2019-10-31T15:19:02.8382092Z ##[section]Finishing: Retain the Build and Release forever

Using extension in YAML pipelines fails with 405 error

Hello.
We are using the extension in azure devops for classic releases and it works perfectly fine :). But i have a question when i try to include the task in a yaml release pipeline we get this error:

Starting: retainRelease

Task : Retain indefinitely current release
Description : This task will allow you to mark the current release to be retained indefinitely
Version : 2.1.0
Author : Mario Majcica
Help : On a successful release to production, usually you will mark the release to be retained for certain amount of time. This task will automate the desired behaviour, by marking the current release to be retained indefinitely.

(node:1824) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1824) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1824) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1824) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:1824) Warning: Use Cipheriv for counter mode of aes-256-ctr
##[error]Failed request: (405)
Finishing: retainRelease

I've tried using classic azure devosp agents, deployment groups agents and enviroments and always it fails with same issue. Can you confirm that this extension can also be used in YAML? IN such case do you a an idea about the issue?
Thanks a lot for you effort and time.

Error: The remote server returned an error: (401) Unauthorized

Hi Mario, thanks for the plugin. It used to work for us and was of great help. However our deployment showed the following error in the release log:

2018-04-23T18:18:46.0647509Z ##[section]Starting: Retain indefinitely current release
2018-04-23T18:18:46.0657494Z ==============================================================================
2018-04-23T18:18:46.0657494Z Task         : Retain indefinitely current release
2018-04-23T18:18:46.0657494Z Description  : This task will allow you to mark the current release to be retained indefinitely
2018-04-23T18:18:46.0657494Z Version      : 1.1.0
2018-04-23T18:18:46.0657494Z Author       : Mario Majcica
2018-04-23T18:18:46.0657494Z Help         : On a successful release to production, usually you will mark the release to be retained for certain amount of time. This task will automate the desired behaviour, by marking the current release to be retained indefinitely.
2018-04-23T18:18:46.0657494Z ==============================================================================
2018-04-23T18:18:47.5747743Z ##[error]The remote server returned an error: (401) Unauthorized.
2018-04-23T18:18:47.5907715Z ##[section]Finishing: Retain indefinitely current release

The "Manage releases" is set to "allow" for the build service. I'm not sure what to do about this, have you got any suggestions?

Retain Indefinitely Failing (Timeout Error)

2021-05-22T03:38:15.4593989Z ##[section]Starting: Retain indefinitely current release
2021-05-22T03:38:15.4894598Z ==============================================================================
2021-05-22T03:38:15.4894950Z Task : Retain indefinitely current release
2021-05-22T03:38:15.4895316Z Description : This task will allow you to mark the current release to be retained indefinitely
2021-05-22T03:38:15.4895599Z Version : 2.1.0
2021-05-22T03:38:15.4895800Z Author : Mario Majcica
2021-05-22T03:38:15.4896340Z Help : On a successful release to production, usually you will mark the release to be retained for certain amount of time. This task will automate the desired behaviour, by marking the current release to be retained indefinitely.
2021-05-22T03:38:15.4896909Z ==============================================================================
2021-05-22T03:38:16.1180323Z (node:7604) Warning: Use Cipheriv for counter mode of aes-256-ctr
2021-05-22T03:38:16.1181086Z (node:7604) Warning: Use Cipheriv for counter mode of aes-256-ctr
2021-05-22T03:38:16.1181942Z (node:7604) Warning: Use Cipheriv for counter mode of aes-256-ctr
2021-05-22T03:38:16.1182522Z (node:7604) Warning: Use Cipheriv for counter mode of aes-256-ctr
2021-05-22T03:38:16.1183241Z (node:7604) Warning: Use Cipheriv for counter mode of aes-256-ctr
2021-05-22T03:38:37.4572361Z ##[error]connect ETIMEDOUT 13.107.42.18:443

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.