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

AmplifyのCI/CD結果をSlackに通知したい #86

Open
jacoyutorius opened this issue Dec 24, 2021 · 2 comments
Open

AmplifyのCI/CD結果をSlackに通知したい #86

jacoyutorius opened this issue Dec 24, 2021 · 2 comments
Labels
good for mobbing モブプロ向き(参考になるハンズオン的な資料があること、知見を複数名で共有しておきたいもの)

Comments

@jacoyutorius
Copy link
Member

jacoyutorius commented Dec 24, 2021

改善詳細 / Details of Improvement

  • Amplify ConsoleのCI/CD結果をSlackに通知したい
    • というよりは、preview用URLをSlackかプルリクのページに記載したい
  • これが参考になりそう?
  • Amplify以外のリソースを使うので
    • できればIaC化(CDKがいいなー)

期待する見せ方・挙動 / Expected behavior

  • デプロイが完了するとプレビュー用URLがSlackに通知される
@jacoyutorius jacoyutorius added the good for mobbing モブプロ向き(参考になるハンズオン的な資料があること、知見を複数名で共有しておきたいもの) label Dec 24, 2021
@euledge
Copy link
Collaborator

euledge commented Dec 24, 2021

curlで直接slack API叩くなら Amplifyのビルドプロセスだけで行けます。
tool/python スクリプト入れておいてpythonでAPI叩くとかもあり(ライブラリありそう)

version: 1
frontend:
  phases:
    build:
      commands:
        - git submodule update --init
        - URL=`[ "$AWS_BRANCH" = "main" ] && echo $BASE_URL || echo https://${AWS_BRANCH/\//-}$BASE_URL`
        - hugo --minify --baseURL=$URL
        - ここ辺りに $URLの値を slackに通知するコマンド書けばよいはず(正確に言うとまだデプロイはされてないけど...) 
        -  Github Actionみたいにtool/のpythonスクリプトも動くと おもいます
  artifacts:
    baseDirectory: public
    files:
      - '**/*'
  cache:
    paths: []

ビルド用のコンテナイメージは、以下のように node,ruby,python使えるはずです
image

@euledge
Copy link
Collaborator

euledge commented Dec 26, 2021

Pythonで公式Slack SDK使った通知のサンプル
https://qiita.com/seratch/items/8f93fd0bf815b0b1d557
ライブラリ使った通知サンプル
https://qlitre-weblog.com/slack-post-by-python/

Githubのプルリクコメントを作成する場合はこっち
https://zenn.dev/yoshi65/articles/github_actions_python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good for mobbing モブプロ向き(参考になるハンズオン的な資料があること、知見を複数名で共有しておきたいもの)
Projects
None yet
Development

No branches or pull requests

2 participants