Skip to content

Commit

Permalink
Merge pull request #10 from nautible/release/2022.2
Browse files Browse the repository at this point in the history
Release/2022.2
  • Loading branch information
ogis-yamanaka authored Oct 19, 2022
2 parents 0cb6dc0 + 227263d commit d70c448
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 19 deletions.
59 changes: 45 additions & 14 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ name: Java CI with Maven

on:
push:
branches: [ main ]
branches: [ "develop","feature/*","hotfix/*" ]
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
build:
Expand All @@ -17,9 +22,9 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Checkout manifest repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: nautible/nautible-app-ms-product-manifest
path: nautible-app-ms-product-manifest
Expand All @@ -41,9 +46,8 @@ jobs:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/nautible-dev-githubactions-ecr-access-role
aws-region: ap-northeast-1
- name: Login to Amazon public ECR
id: login-ecr
run: |
Expand Down Expand Up @@ -90,19 +94,46 @@ jobs:
docker push $ACR_REGISTRY/$ACR_REPOSITORY:latest
docker push $ACR_REGISTRY/$ACR_REPOSITORY:$IMAGE_TAG
- name: update feature branch image tag
id: update-feature-branch-image-tag
if: startsWith(github.ref_name, 'feature/')
env:
TOKEN: ${{ secrets.PAT }}
BRANCH: ${{ github.ref_name }}
APP_NAME: product
run: |
cd $GITHUB_WORKSPACE/nautible-app-ms-$APP_NAME-manifest
HTTP_STATUS=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" https://api.github.com/repos/nautible/nautible-app-ms-$APP_NAME-manifest/branches/$BRANCH -o /dev/null -w '%{http_code}\n' -s)
if [ "$HTTP_STATUS" != '200' ]; then
echo 'couldnt find remote branch. skip update manifest.'
exit 0
fi
git fetch origin $BRANCH && git checkout $BRANCH
sed -i 's/image: public.ecr.aws\/nautible\/nautible-app-ms-'$APP_NAME':\(.*\)/image: public.ecr.aws\/nautible\/nautible-app-ms-'$APP_NAME':'$IMAGE_TAG'/' ./overlays/aws/dev/$APP_NAME-deployment.yaml
sed -i 's/image: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}\/nautible-app-ms-'$APP_NAME':\(.*\)/image: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}\/nautible-app-ms-'$APP_NAME':'$IMAGE_TAG'/' ./overlays/azure/dev/$APP_NAME-deployment.yaml
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "update manifest"
git push
- name: pull request
id: pull-request
if: github.ref_name == 'develop' || startsWith(github.ref_name, 'hotfix/')
env:
token: ${{ secrets.PAT }}
tag: update-image-feature-${{ github.sha }}
TOKEN: ${{ secrets.PAT }}
BRANCH: ${{ github.ref_name }}
TAG: update-image-feature-${{ github.sha }}
APP_NAME: product
run: |
cd $GITHUB_WORKSPACE/nautible-app-ms-product-manifest
git checkout -b $tag
sed -i 's/image: public.ecr.aws\/nautible\/nautible-app-ms-product:\(.*\)/image: public.ecr.aws\/nautible\/nautible-app-ms-product:'$IMAGE_TAG'/' ./overlays/aws/dev/product-deployment.yaml
sed -i 's/image: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}\/nautible-app-ms-product:\(.*\)/image: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}\/nautible-app-ms-product:'$IMAGE_TAG'/' ./overlays/azure/dev/product-deployment.yaml
cd $GITHUB_WORKSPACE/nautible-app-ms-$APP_NAME-manifest
git fetch origin $BRANCH && git checkout $BRANCH
git checkout -b $TAG $BRANCH
sed -i 's/image: public.ecr.aws\/nautible\/nautible-app-ms-'$APP_NAME':\(.*\)/image: public.ecr.aws\/nautible\/nautible-app-ms-'$APP_NAME':'$IMAGE_TAG'/' ./overlays/aws/dev/$APP_NAME-deployment.yaml
sed -i 's/image: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}\/nautible-app-ms-'$APP_NAME':\(.*\)/image: ${{ secrets.AZURE_REGISTRY_LOGIN_SERVER }}\/nautible-app-ms-'$APP_NAME':'$IMAGE_TAG'/' ./overlays/azure/dev/$APP_NAME-deployment.yaml
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "update manifest"
git push --set-upstream origin $tag
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $token" "https://api.github.com/repos/nautible/nautible-app-ms-product-manifest/pulls" -d '{"title": "new image deploy request", "head": "nautible:'$tag'", "base": "main"}' -o /dev/null -w 'httpstatus:%{http_code}\n' -s
git push --set-upstream origin $TAG
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $TOKEN" "https://api.github.com/repos/nautible/nautible-app-ms-$APP_NAME-manifest/pulls" -d '{"title": "new image deploy request", "head": "nautible:'$TAG'", "base": "'$BRANCH'"}' -o /dev/null -w 'httpstatus:%{http_code}\n' -s
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# nautible-app-ms-product project
このドキュメントには商品アプリケーションについて記載する。
アプリケーション共通の内容については[こちら](https://github.com/nautible/docs/app-common/README.md)を参照。
Quarkusアプリケーション共通の内容については[こちら](https://github.com/nautible/docs/quarkus/README.md)を参照。
アプリケーション共通の内容については[こちら](https://github.com/nautible/docs/blob/main/referenceapp-architecture/README.md)を参照。
Quarkusアプリケーション共通の内容については[こちら](https://github.com/nautible/docs/blob/main/reference/quarkus/README.md)を参照。

## アプリケーションの主要アーキテクチャ
* [Java11](https://www.oracle.com/java/)
Expand All @@ -26,7 +26,7 @@ Quarkusアプリケーション共通の内容については[こちら](https:/
### 事前準備
* [dockerのインストール](https://docs.docker.com/get-docker/)
* [minikubeのインストール](https://kubernetes.io/ja/docs/tasks/tools/install-minikube/)
* [kubectlのインストール](https://kubernetes.io/ja/docs/tasks/tools/install-kubectl/)(接続先の設定をminikubeにする
* [kubectlのインストール](https://kubernetes.io/ja/docs/tasks/tools/install-kubectl/)(接続先の設定をminikubeにする
* [skaffoldのインストール](https://skaffold.dev/docs/install/)
* マニフェストファイルの配置
[nautible-app-ms-product-manifest](https://github.com/nautible/nautible-app-ms-product-manifest)をnautible-app-ms-productプロジェクトと同一階層に配置する(git clone)。
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<nautible.app.product.groupId>jp.co.ogis-ri.nautible.app</nautible.app.product.groupId>
<nautible.app.product.name>nautible-app-ms-product</nautible.app.product.name>
<nautible.app.product.version>1.0.0-SNAPSHOT</nautible.app.product.version>
<quarkus-plugin.version>1.13.6.Final</quarkus-plugin.version>
<quarkus-plugin.version>2.13.0.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>1.13.6.Final</quarkus.platform.version>
<quarkus.platform.version>2.13.0.Final</quarkus.platform.version>
<commons-lang3.version>3.11</commons-lang3.version>
<swagger-annotations.version>1.6.2</swagger-annotations.version>
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
Expand Down
37 changes: 37 additions & 0 deletions testdata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 動作確認用テストデータ
## マスターデータ登録
### a) ローカル環境
- ローカル環境では以下のDockerfileでDB構築時に自動的にマスターデータを登録する。
```
nautible-app-ms-product-build/src/test/docker/database/Dockerfile
```

### b) DEV環境
- AWS や Azure 環境では、mysql-client の pod を起動して、product の DB と接続を行い、マスターデータを登録する。

#### mysql-client の pod 起動 / bash 起動
```
kubectl run mysql-client -n nautible-app-ms -it --rm --image=mysql:5.7 --restart=Never -- /bin/bash
※ bash を exit 後は、pod は削除される
```

#### AWS での DB 接続
```
mysql -h product-db.vpc.nautible-dev.com -u <DBユーザー> -p
<DBパスワード>
```
_※ ユーザ、パスワードは AWS Secrets Manager で管理_

#### Azure での DB 接続
```
mysql -h product-fs.product-fs.private.mysql.database.azure.com -u <DBユーザー> -p
<DBパスワード>
```
_※ ユーザ、パスワードは Azure Key Vault で管理_

#### 実行する DDL / DML
```
nautible-app-ms-product-build/src/main/database/01.schema-product.sql
nautible-app-ms-product-build/src/main/database/02.data-product.sql
```

0 comments on commit d70c448

Please sign in to comment.