0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[SAP BTP 開発管理・DevOps 入門] 海外チュートリアルをStep by Stepで解説する(Alert Notifications & Automation Pilot編)

Posted at

はじめに

本記事は「[SAP BTP 開発管理・DevOps 入門] 海外チュートリアルをStep by Stepで解説する」の1項目の説明をなります。全体を把握した方はまずは、こちらをご確認下さい。

また、本記事は概要把握や個人とトライアル利用の参考として、まとめたものなので、プロジェクトでの利用の際は、SAP社への問合せの実施や正式情報であるHelp Portalを活用して下さい。

前提として過去の2つの記事の作業を実施していることが必要になります。

本記事の対象範囲

本記事の前半では、BTPの通知の機能である「Alert Notifications」を用いて、前回作成したパイプラインの作業をトリガにSlackへの通知をします。(また、YouTubeのチュートリアルはSlack通知ですが、環境がない方もいらっしゃると思うので、メール通知をする方法を記事では実施しています。)

後半では、各種作業を自動化するためのサービスである「Automation Pilot」を用いて、前述のチュートリアルでデプロイしたアプリのエンドポイントが動作していることを確認するスモークテストを実施し、その結果を通知にて知らせます。

Step by Step解説

動画8: Alert Notifications

概要

Alert Notifications」のインスタンスの作成後に「Cloud Transport Management」の認証設定を実施します。その後、「Cloud Transport Management」のインポート開始、終了時に、Slackメッセージを送信するための設定を「Alert Notifications」に実施します。

動画

BTP DevOps: Alert Notifications

詳細説明

  1. Introduction
  2. Create SAP Alert Notification service instance with service key
    1. Alert Notifications」のインスタンを作成し、「Cloud Transport Management」からアクセスするための「サービスキー」を発行します。
  3. Create Destination ALERT_NOTIFICATION_SERVICE using service key settings
    1. Cloud Transport Management」から「Alert Notifications」への認証は「Destination」サービスを利用する仕様となっています。ゆえに、ALERT_NOTIFICATION_SERVICEという名称の「Destination」を作成し、作成した「サービスキー」の情報を入力します。
  4. Documentation
    1. Alert Notifications」では各サービスのイベントを検知して、メール送信等のアクションを実施します。「Cloud Transport Management」の「イベント」の名称であるTmsImportStartedを確認します。(2023年3月の該当ヘルプポータル
  5. Create new subscription for events TMS import started and finished; assign action type send message to Slack channel
    1. Alert Notifications」では、なにかしらの「イベント」を検知して、アクションを実行する一連の仕組みを「Subscription」というオブジェクトを用いて管理します。
    2. ここではTmsImportという「Subscription」を設定し、起動条件である「Condition」にTmsImportStarted, TmsImportFinishedという「イベント」が発生した際という条件を設定しています。
  6. Slack: Create app and configure incoming webhook
    1. SlackへのWebhookの仕組みを設定します。
    2. Slackでの通知をしても良いのですが、Slackが無い方はE-mail送信での代替も可能です。その場合はAction Typeの選択で、Emailを選択します。Email Addressに送信したいメールアドレスを入力するだけの簡単な設定でメール送信が可能です。設定後に、通知を有効化して良いかの確認メールが届くので、届いたメールのリンクをクリックし、有効化することが可能です。
  7. Finish create subscription
    1. Subscription」を設定を完了します。
  8. Cloud Transport Management: Configure qa and prod node to perform notification
    1. Cloud Transport Management」における「Alert Notifications」への通知設定を有効化します。
    2. BTPの各種サービスでは、「Alert Notifications」の通知が前提としてサービスが構築されているため、このようにサービス内での通知設定を変更することにより、「イベント」が発信され、通知を実施するための仕組の構築が可能です。
  9. Business Application Studio: Stage, commit and push
    1. 再度、BASからのPushを実施します。それによりインポートキューが追加されます。
  10. Cloud Transport Management: Import build into qa
    1. キューをインポートするとインポートが開始され、Slackに通知が実施されます。
    2. Trialではqa環境に構築が実施できないため、インポートはエラーとなりますが、開始の通知は届くはずです。

動画9: Automation Pilot Pt 1

概要

Automation Pilot」ののインスタンを作成し、検証環境のエンドポイントが稼働していることを確認するための、「Automation Pilot」のコマンドをテスト実行します。ただし、TrialのUSのRegionでサービスが提供されていないため、検証機上にアプリケーションをデプロイできていないため、本チュートリアルはTrial環境では実施できません。

Trial環境で実施するための追加のオリジナルのチュートリアル準備してるので、まずは下記で実施できないこのチュートリアルの詳細説明を実施します。
※Azure(Singapore)にてサブアカウントを作成すれば、「Automation Pilot」のサービスを試すことは可能です。

詳細説明

  1. Introduction
  2. Subscribe to SAP Automation Pilot
    1. Automation Pilot」のインスタンスを作成します。
  3. Add role collection to business user
    1. ロールコレクションを追加します。
  4. SAP Automation Pilot
    1. 「Automation Pilot」を起動します。
  5. BTP Cockpit: Alert Notification, create service key
    1. Alert Notifications」に移り、「Automation Pilot」から「Alert Notifications」に接続するためのサービスキーを発行します。設定のパラメータにて「Basic認証」であることを指定すると認証に必要な情報が発行されます。
  6. SAP Automation Pilot: Create alert notification with username and password
    1. Automation Pilot」側に認証情報を設定します。「Automation Pilot」は「Alert Notifications」にサービス連携可能な作り込みがされているため、該当箇所に認証情報を入力するだけで、接続設定が完了します。
  7. Create command
    1. Automation Pilot」の実行オブジェクトである「command」を登録します。
  8. Import Catalog as JSON from code sample
    1. 「command」は各種の設定が必要となるため、あらかじめ登録されたものを「Catalog」としてインポートします。
    2. 「Catalog」は2つの要素より構成されています。一つ目は「command」で「Automation Pilot」の自動実行する内容を定義したものです。2つめは「Inputs」で「command」に受け渡す変数を定義します。
  9. Configure input: appName, appPath, datacenter, user, password
    1. インポートしたものに対して、必要な各種の情報をインプットします。
  10. Trigger command
    1. 実際にcommandを実行します。結果としては前の手順で設定したユーザに必要な権限が付与されていないため、エラーとなります。
    2. 基本的には変数は、「Inputs」に定義しているのですが、「command」の実行毎に変更したい項目については「tag」として実行時の変数として定義します。
  11. BTP Cockpit: Assign app_Viewer role collection to technical user in qa and prod subaccount
    1. まずはqaに関して必要な権限を付与して実行をします。その後、テストを実行するとテストが完了します。
    2. 最後にprodに関しても必要な権限を付与します。

動画: 10.Automation Pilot Pt 2

BTP DevOps: Automation Pilot Pt 2

概要

このチュートリアルもTrialでは実施できませんが、詳細のみ実施します。

全体の流れとしては、「Cloud Transport Management」のインポートが終了した時点で、スモークテストを実施し、その結果を通知します。

ポイントしては、「Alert Notifications」の通知先として前回の動画で作成した「command」を指定するスモークテストの「Subscription」を作成します。そして「Automation Pilot」のログを検知するための「Subscription」を作成します。この2つの「Subscription」によって、スモークテストの実施および結果通知を自動化します。

詳細説明

  1. Introduction
  2. Automation Pilot: Execution, build event trigger
    1. 前回の動画ではコンソールから実行した「Automation Pilot」の「command」を外部から実行するためにURLを生成します。
  3. BTP Cockpit: create alert subscription with Automation Pilot action
    1. 新規で「Alert Notifications」の「Subscription」を作成します。開始条件には、「Cloud Transport Management」のインポートが終了を意味するTmsImportFinishedという「イベント」を指定します。
    2. Actionには前のステップで作成した、コマンドの実行を指定します。
  4. Automation Pilot: create service account
    1. Automation Pilot」に連係するための認証情報を登録します。
  5. BTP Cockpit: create alert subscription with Slack notification
    1. Automation Pilot」の実行結果をSlackに連係するための「Subscription」を登録します。
  6. Cloud Transport Management: Import queue from qa to prod
    1. インポートが完了すると、作成した機能が動作し、スモークテストと通知が実行されます。
  7. Recap

最後に

Trialの制約からあまり多くの作業ができなかったため、追加でTrialでもできるチュートリアル記事を書く予定です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?