-
Notifications
You must be signed in to change notification settings - Fork 28
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
✨ stagingブランチを設定する事でstaging環境でデプロイされるように #2488
base: master
Are you sure you want to change the base?
Changes from all commits
4f44977
0ece60a
d019c8a
d23a6c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -4,19 +4,27 @@ on: | |||
push: | ||||
branches: | ||||
- master | ||||
workflow_dispatch: | ||||
inputs: | ||||
branch: | ||||
description: 'Branch to deploy' | ||||
required: true | ||||
default: 'master' | ||||
|
||||
env: | ||||
IMAGE_NAME: traq | ||||
IMAGE_TAG: master | ||||
IMAGE_TAG: ${{ github.event.inputs.branch || 'master' }} | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ちゃんとsanitizeするか、"dev"とか"staging"でとりあえず固定するのが楽じゃないですか? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 固定はしたくないなら、デプロイスクリプトもcomposeの中のイメージ名書き換えるようにしましょう There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stagingで固定しちゃおうと思います There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ならデプロイスクリプト側もmaster参照からstaging参照にする必要がありますね There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 正直イマイチ方針がよく分かってないのですが、以下の流れで良いでしょうか? デプロイスクリプトは → https://git.trap.jp/SysAd/tokyotech.org/src/branch/master/roles/traq/files/deploy.sh です。 なので、
となっているところを、
に変更する。(traq-frontendに対しても同等の事を行う? 他の箇所にも影響が出そうで怖い) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. これはm011に繋いでいるはずです traQ/.github/workflows/master.yml Line 72 in 9918b0c
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (stagingで固定するなら時すでに遅しで使わなそうだけど) git tagからimage tagを生成するはこういうのがあるらしい |
||||
|
||||
jobs: | ||||
image: | ||||
name: Build Docker Image | ||||
runs-on: ubuntu-latest | ||||
steps: | ||||
- uses: actions/checkout@v4 | ||||
with: | ||||
ref: ${{ github.event.inputs.branch || 'master' }} | ||||
- name: Set TRAQ_VERSION env | ||||
run: echo "TRAQ_VERSION=master-SNAPSHOT" >> $GITHUB_ENV | ||||
run: echo "TRAQ_VERSION=${{ github.event.inputs.branch || 'master' }}-SNAPSHOT" >> $GITHUB_ENV | ||||
- name: Set TRAQ_REVISION env | ||||
run: echo "TRAQ_REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||||
- name: Set up QEMU | ||||
|
@@ -44,13 +52,16 @@ jobs: | |||
TRAQ_VERSION=${{ env.TRAQ_VERSION }} | ||||
TRAQ_REVISION=${{ env.TRAQ_REVISION }} | ||||
tags: | | ||||
ghcr.io/traptitech/${{ env.IMAGE_NAME }}:master | ||||
ghcr.io/traptitech/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | ||||
|
||||
scan: | ||||
name: Scan Image Vulnerability | ||||
runs-on: ubuntu-latest | ||||
needs: [image] | ||||
steps: | ||||
- uses: actions/checkout@v4 | ||||
with: | ||||
ref: ${{ github.event.inputs.branch || 'master' }} | ||||
- name: Pull docker image | ||||
run: docker pull ghcr.io/traptitech/${IMAGE_NAME}:${IMAGE_TAG} | ||||
- name: Container image scan | ||||
|
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.
ブランチ指定で動かすのは特に設定なしでできます
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.
https://github.com/traPtitech/traQ/blob/master/.github/workflows/renovate.yml
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.
workflow_dispatch:
だけでも良さそうですが、説明とデフォルト付けた方が良いかなと思うので残しておこうと思ってます。
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.
これたぶんpikachuが思ってる挙動と違って、このデフォルトであるドロップダウンの下にinputがもう一つ生えてそこにブランチ入力することになります
ドロップダウンのデフォルトはレポジトリのデフォルトブランチです
ここのDry-runにブランチ名を入力することになる
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.
なるほど、なら
workflow_dispatch:
だけで良さそうですね。ありがとうございます。