From 88843d0baf99c373cdb07b8cc399bb8ef00206ef Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:24:48 -0600 Subject: [PATCH 1/5] README correction, AWS PHP SDK -> AWS API [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01ed9352..cf74def8 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ AWS: * `CONFIG_ID` - the configuration profile ID or name * `ENV_ID` - the environment ID or name -In addition, the AWS PHP SDK requires authentication. It is best to use an access role +In addition, the AWS API requires authentication. It is best to use an access role such as an [ECS Task Role](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html). If that is not an option, you can specify an access token using the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` variables. From d360334299116a122ec27450f87ca2404cdf29fc Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:28:45 -0600 Subject: [PATCH 2/5] set version string to develop --- application/common/config/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/common/config/main.php b/application/common/config/main.php index 75662c2e..512251ed 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -201,7 +201,7 @@ 'clientOptions' => [ 'attach_stacktrace' => false, // stack trace identifies the logger call stack, not helpful 'environment' => YII_ENV, - 'release' => 'idp-id-broker@6.7.0', + 'release' => 'idp-id-broker@develop', 'max_request_body_size' => 'never', // never send request bodies 'before_send' => function (Event $event) use ($idpName): ?Event { $event->setExtra(['idp' => $idpName]); From eff1c2d2832a3e51fc35dbe77e6a8f31fbe463bb Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Fri, 5 Apr 2024 08:18:38 -0600 Subject: [PATCH 3/5] fail earlier if a bad `employee_id` is given --- application/frontend/controllers/MethodController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/frontend/controllers/MethodController.php b/application/frontend/controllers/MethodController.php index 6d9c6bd8..c321955d 100644 --- a/application/frontend/controllers/MethodController.php +++ b/application/frontend/controllers/MethodController.php @@ -109,6 +109,12 @@ public function actionCreate() } $userId = User::findOne(['employee_id' => $employeeId])->id ?? null; + if ($userId == null) { + throw new NotFoundHttpException( + 'employee_id not found', + 1540990165 + ); + } return Method::findOrCreate($userId, $value); } From bbb6df4c311c5a99deccc9fbe08280079c9f159c Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Fri, 5 Apr 2024 09:13:02 -0600 Subject: [PATCH 4/5] use GITHUB_REF_NAME in main.php for the Sentry 'release' attribute --- .github/workflows/test-and-publish.yml | 2 ++ Dockerfile | 3 +++ application/common/config/main.php | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml index e64ea490..c7ce5c7f 100644 --- a/.github/workflows/test-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -42,3 +42,5 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + GITHUB_REF_NAME=${{ GITHUB_REF_NAME }} diff --git a/Dockerfile b/Dockerfile index 7f933ab0..75a50902 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM silintl/php8:8.1 +ARG GITHUB_REF_NAME +ENV GITHUB_REF_NAME=$GITHUB_REF_NAME + ENV REFRESHED_AT 2024-02-27 RUN apt-get update -y && \ diff --git a/application/common/config/main.php b/application/common/config/main.php index 512251ed..08f3bec7 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -201,7 +201,7 @@ 'clientOptions' => [ 'attach_stacktrace' => false, // stack trace identifies the logger call stack, not helpful 'environment' => YII_ENV, - 'release' => 'idp-id-broker@develop', + 'release' => 'idp-id-broker@' . Env::get('GITHUB_REF_NAME', 'unknown'), 'max_request_body_size' => 'never', // never send request bodies 'before_send' => function (Event $event) use ($idpName): ?Event { $event->setExtra(['idp' => $idpName]); From 9c8a8b729c8ee5b000a8d6deae95129c10aa4b30 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Fri, 5 Apr 2024 09:20:17 -0600 Subject: [PATCH 5/5] use github.ref_name instead (and remove from PR checklist) --- .github/pull_request_template.md | 3 --- .github/workflows/test-and-publish.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index cb27949b..035ed464 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -23,6 +23,3 @@ - [ ] Unit tests created or updated - [ ] Run `make composershow` - [ ] Run `make psr2` - -### Release PR Checklist -- [ ] Update version number in main.php Sentry configuration diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml index c7ce5c7f..978db171 100644 --- a/.github/workflows/test-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -43,4 +43,4 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - GITHUB_REF_NAME=${{ GITHUB_REF_NAME }} + GITHUB_REF_NAME=${{ github.ref_name }}