-
Hi,
I figured out how to push to OneDev registry. It turns out it does not need any special settings.
Bu the tag number question remains. How to automate the process of tagging/numbering builds. Ideally I would like to use last git tag, this way docker images tags and git tags would stay in sync.
-
-
Is it possible to programmatically from job script to modify Job properties? If this is possible, I could add one step
Execute Commandand calculate the desired TAG for the docker image and store it in the Job properties and then reuse them in docker build step. Is this possible? -
-
Write the tag into a file inside job workspace
TAG_NO=$(git describe --tags --abbrev=0) echo $TAG_NO > $ONEDEV_WORKSPACE/tag_no -
When build or push image, use the tag
@file:tag_no@
-
-
I tend to use two steps at the very beginning:
- Detect build version: uses git to write tag/version information to a file
- OneDev's
Set build versionstep to tell OneDev about the build version using@file:<filename>@. The build version then also appears in the list of builds in OneDev UI.
Then all other steps which require a build version use OneDev's
@build_version@property. -
Sounds good, thank you.
Just one more question. This would be "execute commands" step, what docker image do you use for such simple commands?
-
-
I have just tried this solution and there seems to be problem. Maybe you can help. The command:
git describe --tags --abbrev=0results in error message:
fatal: No names found, cannot describe anything.I executed
lsduring build and can confirm that.gitand all other files are there but there seems to be no information about tags. Should I checkout code differently? -
Ok, found solution for my last question. For future reference adding command:
git fetch --tagsretrieved tags for the repo and then all worked as expected.
And I use
alpine/gitdocker image for this step. Please let me know if you have a better suggestion.Otherwise this ticket can be closed.
Thank you for all your help.
-
-
alpine/git is a good image for this task
-
Previous Value Current Value Open
Closed
| Type |
Question
|
| Priority |
Normal
|
| Assignee | |
| Labels |
No labels
|
Hi,
I am trying to create buildspec to build docker image for the project and push it to
Packageson my OneDev instance docker registry.Now for the tag number I would like to use the most recent tag from the git repository tags. I know how to get the tag from the git repo:
Docker Image\Build Imagestep?