-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: support publish_server_image to dockerhub automatically (V2) #1
Conversation
|
@Radeity could also take a look for it when free, THX |
|
||
- name: Get current commit-hash | ||
run: | | ||
current_commit_hash=$(git rev-parse HEAD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: seems current_commit
VS last_commit
is enough
rename to current_commit
(remove hash
suffix)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to keep the style same as the one in name "Get current commit-hash"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to keep the style same as the one in name "Get current commit-hash"
fine, u could update the title style or not
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: check if the docker image cache work well (seems doesn't take effect now?)
could fix it in next/another PR, just address it
Co-authored-by: imbajin <[email protected]>
Co-authored-by: imbajin <[email protected]>
Co-authored-by: imbajin <[email protected]>
env: | ||
repository_url: apache/hugegraph | ||
branch: master | ||
image_url: hugegraph/hugegraph:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refer server CI file, maybe we could:
- use the
env.xx
directly? like
and search/ask GPT for the difference between $param
& ${{env.param}}
in action (seems $param
looks better)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The difference is mentioned in https://hugegraph.feishu.cn/docx/U8LKdSsxWoyxlnxKSXPcNoOanJd#HpV9dR7UfoCbyOxsxwNcRucHnCf
- I do not find a way to use regexp when setting the env, same with gpt
repository: ${{ env.REPOSITORY_URL }} | ||
ref: ${{ env.BRANCH }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference between ${{ env.BRANCH }}
& $BRANCH
? how to choose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They do not have real difference, but in Github action docs, it said that:
"Runner environment variables are always interpolated on the runner machine. However, parts of a workflow are processed by GitHub Actions and are not sent to the runner. You cannot use environment variables in these parts of a workflow file. Instead, you can use contexts. For example, an if conditional, which determines whether a job or step is sent to the runner, is always processed by GitHub Actions. You can use a context in an if conditional statement to access the value of an variable."
It mease that we can not directly use $BRANCH in these parts like "if" or "with", and we must use env context to get them. Because they are processed by github action, but not runner machine. You can not use $BRANCH to get the value. In github action, there is not $BRANCH, but only the env context or other context.
But in "run statement", these vars are sent to runner machine instead of github action, where we can use $BRANCH directly to get the value.
BTW, in "if conditional statement", use ${{ }} seems to be the recommended way, I have fixed it.
-d '{"name":"'"$var_name"'","value":"'"$current_commit_hash"'"}' | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
https://api.github.com/repos/$OWNER/$REPO/actions/variables/LAST_COMMIT_HASH \ | ||
-d '{"name":"LAST_COMMIT_HASH","value":"'"$CURRENT_COMMIT_HASH"'"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I develop on remote server with vsc remote-ssh plugin, and there is no copy on my local machine. Github desktop can not deal with the case.
Is there any recommended plugin to check problem like these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I develop on remote server with vsc remote-ssh plugin, and there is no copy on my local machine. Github desktop can not deal with the case. Is there any recommended plugin to check problem like these?
check it manually after u push the commit:)
This comment was marked as resolved.
This comment was marked as resolved.
I can not see the pending msg. And in this reply, this image.png is also invisible. |
I will ask the admin for help
Aaron Wang ***@***.***> 于 2023年9月1日周五 下午5:07写道:
… [image: image.png] It seems to have a pending label, maybe it is invisible
to you? Aaron Wang *@*.
*> 于2023年9月1日周五 15:24写道: … <#m_-7535884572093133655_> @.** commented on
this pull request. ------------------------------ In
.github/workflows/publish_latest_server_image.yml <#1 (comment)
<#1 (comment)>>: >
+ schedule: + - cron: '0 23 * * *' Hi @aroundabout
<https://github.com/aroundabout> https://github.com/aroundabout
<https://github.com/aroundabout> , may I ask why you mark this comment as
resolved without any comment? Just some humble suggestion, feel free to
express different opinion :D — Reply to this email directly, view it on
GitHub <#1 (comment)
<#1 (comment)>>, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AL2ZYVH6SHJU2KFUR6E5ILLXYGERLANCNFSM6AAAAAA3IBHZKY
<https://github.com/notifications/unsubscribe-auth/AL2ZYVH6SHJU2KFUR6E5ILLXYGERLANCNFSM6AAAAAA3IBHZKY>
. You are receiving this because you were mentioned.Message ID: @.***>
I can not see the pending msg. And also in this reply, this image.png is
also invisible.
[image: image]
<https://user-images.githubusercontent.com/45198818/264977371-9fd4c950-3bc0-4b6e-9492-0452bd1152c0.png>
—
Reply to this email directly, view it on GitHub
<#1 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AL2ZYVBNGNWNX3PKBGJHCYDXYGQWTANCNFSM6AAAAAA3IBHZKY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
steps: | ||
- name: Set branch | ||
run: | | ||
branch=${{ inputs.branch=='' && env.branch || inputs.branch }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can choose specific branch instead of release-{tag} as the branch.
Generally, we only need to provide the tag, then the branch will be set to "release-{tag}"
|
||
- name: Updata last SHA | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, "PAT" is a token accessible to the repo to set public vars
repository: ${{ env.REPOSITORY_URL }} | ||
ref: ${{ env.BRANCH }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They do not have real difference, but in Github action docs, it said that:
"Runner environment variables are always interpolated on the runner machine. However, parts of a workflow are processed by GitHub Actions and are not sent to the runner. You cannot use environment variables in these parts of a workflow file. Instead, you can use contexts. For example, an if conditional, which determines whether a job or step is sent to the runner, is always processed by GitHub Actions. You can use a context in an if conditional statement to access the value of an variable."
It mease that we can not directly use $BRANCH in these parts like "if" or "with", and we must use env context to get them. Because they are processed by github action, but not runner machine. You can not use $BRANCH to get the value. In github action, there is not $BRANCH, but only the env context or other context.
But in "run statement", these vars are sent to runner machine instead of github action, where we can use $BRANCH directly to get the value.
BTW, in "if conditional statement", use ${{ }} seems to be the recommended way, I have fixed it.
-d '{"name":"'"$var_name"'","value":"'"$current_commit_hash"'"}' | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
https://api.github.com/repos/$OWNER/$REPO/actions/variables/LAST_COMMIT_HASH \ | ||
-d '{"name":"LAST_COMMIT_HASH","value":"'"$CURRENT_COMMIT_HASH"'"}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I develop on remote server with vsc remote-ssh plugin, and there is no copy on my local machine. Github desktop can not deal with the case.
Is there any recommended plugin to check problem like these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now
REPOSITORY_URL: apache/hugegraph | ||
BRANCH: master | ||
IMAGE_URL: hugegraph/hugegraph:latest | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PAT
means?
Purpose of PR
subtask of apache/incubator-hugegraph#840
Main change
Api reference: This api help us to update the github repo var Update a repository variable
old desgin doc: apache/incubator-hugegraph#2254
new design doc: extra design doc
new change
Before Merge
Create a branch in apache/hugegraph repo, then I can submit a pr of the release-1.0.0 with correct dockerfile and other shell. it needs the admin to create.
Before merge, admin should confirm that there are the repository secrets "DOCKERHUB_PASSWORD", "DOCKERHUB_USERNAME", "PAT" are provided, where "PAT" is a token accessible to the repo.
Repository variables "LATEST_SHA" should be provided. Because there is no "create an update" api, "LATEST_SHA" are necessary.