Auto semantic versioning in AWS CodePipelines / CodeBuild

0

Hi, I have been using Azure Pipelines and have been exploring AWS as an alternative.

In my Azure Repo, my build yml can have the following lines

variables:
  major: 1
  minor: 2
  patch: 4
  build: $[counter(variables['patch'], 0)]
name: $(major).$(minor).$(patch).$(build)

$[counter()] is a special azure variable that will auto increment if the value inside does not change. What this does is that every time I run my pipeline, the build number will automatically go up (eg. 1.2.4.2 -> 1.2.4.3) When I change the patch number, the build number will reset to 0.

I can also specify my build in Azure like so:

$[counter(format('{0}-{1}',variables['patch'],variables[$(Build.SourceBranchName)]), 0)] 

in order to reset the build number to 0 when I change to a new branch.

Does AWS have anything similar for an auto increasing number that can reset on a variable change / new branch? I read some online article about using Lambda to do it but that seems convoluted and lambda costs money to run.

질문됨 4달 전255회 조회
1개 답변
0

Hi, In. this article, you have sem auto-versionning for an AWS Pipeline with code on GitHub repo: https://alexrmoran.medium.com/automatic-semver-versioning-using-github-actions-and-deploying-to-aws-pipeline-5fcbf7e5cce4

AWS Commit is equivalent to Azure Repo and GitHub repos

If you combine this article, with this AWS doc re. semver for AWS CodeBuild, you can achieve what you're after.

Best,

Didier

profile pictureAWS
전문가
답변함 4달 전
  • Hi, the article mentions MAJOR.MINOR.PATCH, but what I'm trying to do is MAJOR.MINOR.PATCH.BUILD, with BUILD being an auto increment on every pipeline run. Even a manual pipeline run should auto increment the BUILD number, which semver seems to only do on a commit (?)

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠