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

[ci] Fix the SONiC version starting with HEAD issue #7299

Closed
wants to merge 1 commit into from

Conversation

xumia
Copy link
Collaborator

@xumia xumia commented Apr 13, 2021

Why I did it

Fix the SONiC version starting with HEAD issue. For example, sonic-broadcom-HEAD.40620469-1d98d18cf.bin.

How I did it

Allow the azure pipelines to input the correct branch name to overwrite the default HEAD value.

How to verify it

$ git branch 
* (HEAD detached at ca072d2)
$ sonic_get_version
HEAD.0-ca072d2
export BRANCH_NAME=201911
$ sonic_get_version
201911.0-ca072d2

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

@xumia xumia requested a review from lguohan as a code owner April 13, 2021 04:49
@xumia xumia requested a review from qiluo-msft April 13, 2021 04:49
@xumia xumia added the ci label Apr 13, 2021
@xumia xumia changed the title Fix the SONiC version starting with HEAD issue [ci] Fix the SONiC version starting with HEAD issue Apr 13, 2021
@@ -54,6 +54,7 @@ sonic_get_version() {
local describe=$(git describe --tags)
local latest_tag=$(git describe --tags --abbrev=0)
local branch_name=$(git rev-parse --abbrev-ref HEAD)
Copy link
Collaborator

Choose a reason for hiding this comment

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

branch_name

Do you know why the old code does not work? Is the local folder under git control?

Copy link
Collaborator Author

@xumia xumia Apr 13, 2021

Choose a reason for hiding this comment

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

When checking out code, the azure pipeline checkout task does not set the local branch name, looks like the azure pipelines not support it very well. But azure pipeline provides a environment variable build.SourceBranchName, it tells which branch the code checked-out from.

Azure Pipelines:
$ git branch -vv
(HEAD detached at ca072d2) ca072d2 Disable CI/CD trigger
vmss-soni00007E:/agent/_work/1/s$ git rev-parse --abbrev-ref HEAD
HEAD

Jenkins:
jenkins-worker-2:/data/johnar/workspace/broadcom/buildimage-brcm-all$ git branch -vv
master 32b5b02 [sonic-platform-daemons] Update submodule (#7277)
jenkins-worker-2:/data/johnar/workspace/broadcom/buildimage-brcm-all$ git rev-parse --abbrev-ref HEAD
master

Copy link
Collaborator

Choose a reason for hiding this comment

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

it is better to address this from the azp script. otherwise, we have to cherry-pick this pr all the way to 201811 branch.

@lguohan
Copy link
Collaborator

lguohan commented Apr 16, 2021

@xumia, can you close this pr if it is not needed?

@xumia xumia closed this Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants