From e499f3edba0daf2179b70b28579cb1ac249a3c10 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:36:12 -0700 Subject: [PATCH 1/3] test and build on GitHub actions --- .github/workflows/test-and-publish.yml | 44 ++++++++++++++ actions-services.yml | 79 ++++++++++++++++++++++++++ codeship-services.yml | 78 ------------------------- codeship-steps.yml | 25 -------- dockercfg.encrypted | 2 - 5 files changed, 123 insertions(+), 105 deletions(-) create mode 100644 .github/workflows/test-and-publish.yml create mode 100644 actions-services.yml delete mode 100644 codeship-services.yml delete mode 100644 codeship-steps.yml delete mode 100644 dockercfg.encrypted diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml new file mode 100644 index 0000000..599e839 --- /dev/null +++ b/.github/workflows/test-and-publish.yml @@ -0,0 +1,44 @@ +name: Test and Publish + +on: + push: + +env: + IMAGE_NAME: ${{ vars.DOCKER_ORG }}/idp-id-sync + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Check PSR2 + run: docker-compose -f actions-services.yml run --rm app ./check-psr2.sh + - name: Run unit tests + run: docker-compose -f actions-services.yml run --rm app ./run-tests.sh + + build-and-publish: + name: Build and Publish + needs: tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/actions-services.yml b/actions-services.yml new file mode 100644 index 0000000..f881063 --- /dev/null +++ b/actions-services.yml @@ -0,0 +1,79 @@ +version: "3" + +services: + app: + build: . + depends_on: + - broker + - brokerdb + working_dir: /data + environment: + APP_ENV: test + EMAIL_SERVICE_accessToken: dummy + EMAIL_SERVICE_assertValidIp: "false" + EMAIL_SERVICE_baseUrl: http://email + EMAIL_SERVICE_validIpRanges: 192.168.0.0/16 + ID_BROKER_ADAPTER: fake + ID_BROKER_CONFIG_accessToken: codeship-sync-to-broker-11111111 + ID_STORE_ADAPTER: fake + IDP_NAME: Test + + broker: + image: silintl/idp-id-broker:latest + environment: + APP_ENV: test + API_ACCESS_KEYS: codeship-sync-to-broker-11111111 + EMAIL_SERVICE_accessToken: dummy + EMAIL_SERVICE_assertValidIp: "false" + EMAIL_SERVICE_baseUrl: http://email + EMAIL_SERVICE_validIpRanges: 192.168.0.0/16 + EMAILER_CLASS: \Sil\SilIdBroker\Behat\Context\fakes\FakeEmailer + IDP_NAME: local + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_HOST: brokerdb + MYSQL_DATABASE: broker + MYSQL_USER: broker + MYSQL_PASSWORD: broker + MFA_TOTP_apiBaseUrl: not_needed_here + MFA_TOTP_apiKey: not_needed_here + MFA_TOTP_apiSecret: not_needed_here + MFA_WEBAUTHN_apiBaseUrl: not_needed_here + MFA_WEBAUTHN_apiKey: not_needed_here + MFA_WEBAUTHN_apiSecret: not_needed_here + depends_on: + - brokercron + - brokerdb + command: whenavail brokerdb 3306 60 ./run.sh + + brokercron: + image: silintl/idp-id-broker:latest + environment: + API_ACCESS_KEYS: local-sync-123 + EMAIL_SERVICE_accessToken: dummy + EMAIL_SERVICE_assertValidIp: "false" + EMAIL_SERVICE_baseUrl: http://email + EMAIL_SERVICE_validIpRanges: 10.20.40.0/24 + EMAILER_CLASS: \Sil\SilIdBroker\Behat\Context\fakes\FakeEmailer + IDP_NAME: local + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_HOST: brokerdb + MYSQL_DATABASE: broker + MYSQL_USER: broker + MYSQL_PASSWORD: broker + MFA_TOTP_apiBaseUrl: not_needed_here + MFA_TOTP_apiKey: not_needed_here + MFA_TOTP_apiSecret: not_needed_here + MFA_WEBAUTHN_apiBaseUrl: not_needed_here + MFA_WEBAUTHN_apiKey: not_needed_here + MFA_WEBAUTHN_apiSecret: not_needed_here + depends_on: + - brokerdb + command: whenavail brokerdb 3306 60 ./run-cron.sh + + brokerdb: + image: mariadb:10 + environment: + MYSQL_ROOT_PASSWORD: rootpass + MYSQL_DATABASE: broker + MYSQL_USER: broker + MYSQL_PASSWORD: broker diff --git a/codeship-services.yml b/codeship-services.yml deleted file mode 100644 index ce48579..0000000 --- a/codeship-services.yml +++ /dev/null @@ -1,78 +0,0 @@ -app: - build: - image: silintl/idp-id-sync - dockerfile_path: ./Dockerfile - depends_on: - - broker - - brokerdb - working_dir: /data - environment: - APP_ENV: test - EMAIL_SERVICE_accessToken: dummy - EMAIL_SERVICE_assertValidIp: "false" - EMAIL_SERVICE_baseUrl: http://email - EMAIL_SERVICE_validIpRanges: 192.168.0.0/16 - ID_BROKER_ADAPTER: fake - ID_BROKER_CONFIG_accessToken: codeship-sync-to-broker-11111111 - ID_STORE_ADAPTER: fake - IDP_NAME: Test - -broker: - image: silintl/idp-id-broker:latest - environment: - APP_ENV: test - API_ACCESS_KEYS: codeship-sync-to-broker-11111111 - EMAIL_SERVICE_accessToken: dummy - EMAIL_SERVICE_assertValidIp: "false" - EMAIL_SERVICE_baseUrl: http://email - EMAIL_SERVICE_validIpRanges: 192.168.0.0/16 - EMAILER_CLASS: \Sil\SilIdBroker\Behat\Context\fakes\FakeEmailer - IDP_NAME: local - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_HOST: brokerdb - MYSQL_DATABASE: broker - MYSQL_USER: broker - MYSQL_PASSWORD: broker - MFA_TOTP_apiBaseUrl: not_needed_here - MFA_TOTP_apiKey: not_needed_here - MFA_TOTP_apiSecret: not_needed_here - MFA_WEBAUTHN_apiBaseUrl: not_needed_here - MFA_WEBAUTHN_apiKey: not_needed_here - MFA_WEBAUTHN_apiSecret: not_needed_here - depends_on: - - brokercron - - brokerdb - command: whenavail brokerdb 3306 60 ./run.sh - -brokercron: - image: silintl/idp-id-broker:latest - environment: - API_ACCESS_KEYS: local-sync-123 - EMAIL_SERVICE_accessToken: dummy - EMAIL_SERVICE_assertValidIp: "false" - EMAIL_SERVICE_baseUrl: http://email - EMAIL_SERVICE_validIpRanges: 10.20.40.0/24 - EMAILER_CLASS: \Sil\SilIdBroker\Behat\Context\fakes\FakeEmailer - IDP_NAME: local - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_HOST: brokerdb - MYSQL_DATABASE: broker - MYSQL_USER: broker - MYSQL_PASSWORD: broker - MFA_TOTP_apiBaseUrl: not_needed_here - MFA_TOTP_apiKey: not_needed_here - MFA_TOTP_apiSecret: not_needed_here - MFA_WEBAUTHN_apiBaseUrl: not_needed_here - MFA_WEBAUTHN_apiKey: not_needed_here - MFA_WEBAUTHN_apiSecret: not_needed_here - depends_on: - - brokerdb - command: whenavail brokerdb 3306 60 ./run-cron.sh - -brokerdb: - image: mariadb:10 - environment: - MYSQL_ROOT_PASSWORD: rootpass - MYSQL_DATABASE: broker - MYSQL_USER: broker - MYSQL_PASSWORD: broker diff --git a/codeship-steps.yml b/codeship-steps.yml deleted file mode 100644 index b71d169..0000000 --- a/codeship-steps.yml +++ /dev/null @@ -1,25 +0,0 @@ -- name: check_psr2 - service: app - command: /data/check-psr2.sh - -- name: test - service: app - command: /data/run-tests.sh - -- name: push - service: app - type: push - image_name: silintl/idp-id-sync - image_tag: "{{.Branch}}" - exclude: main - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted - -- name: push_latest - service: app - type: push - image_name: silintl/idp-id-sync - image_tag: "latest" - tag: main - registry: https://index.docker.io/v1/ - encrypted_dockercfg_path: dockercfg.encrypted diff --git a/dockercfg.encrypted b/dockercfg.encrypted deleted file mode 100644 index 869060a..0000000 --- a/dockercfg.encrypted +++ /dev/null @@ -1,2 +0,0 @@ -codeship:v2 -C/qhbUcTKcOsXlEH1s7KVZtl6q+TTMxNEcqW4OdYJjVWxy5h8kASrynDoGl1nu+YNRyytMU+Td/a+Jf0JgjaX/2qaVgAHIgufcX6E+YISVhSIqyaJRhOZzf0P3EtZLQxHs3GEzq5THcLRfUFCnpnSnUiObgPx3lIZ8q/ZiD+SXfyabDo8qtqCq0xmyg6OuVqXAAwUO54z3zLMGehJHI52c6SqRg468XaiglF9iFrkt5FbDsz4HxOZbU9VObmwu6ww3+cun7FTkgckZcVqPhJzO2gkGKNg5aB5M8ulFoRHFwWCdAVTu/8YIPFFPgZ \ No newline at end of file From 207e79a161c2d4e64238fd21b5e56f4326f6fbd4 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:37:13 -0700 Subject: [PATCH 2/3] 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 210fbf6..a354aec 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -131,7 +131,7 @@ 'clientOptions' => [ 'attach_stacktrace' => false, // stack trace identifies the logger call stack, not helpful 'environment' => YII_ENV, - 'release' => 'idp-id-sync@5.1.1', + 'release' => 'idp-id-sync@develop', 'before_send' => function (Event $event) use ($idpName): ?Event { $event->setExtra(['idp' => $idpName]); return $event; From 6f12349bd33d68fb2835f0fa38e20e39e9c370cc Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:39:36 -0700 Subject: [PATCH 3/3] set version string to 5.1.2 --- 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 a354aec..28961f2 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -131,7 +131,7 @@ 'clientOptions' => [ 'attach_stacktrace' => false, // stack trace identifies the logger call stack, not helpful 'environment' => YII_ENV, - 'release' => 'idp-id-sync@develop', + 'release' => 'idp-id-sync@5.1.2', 'before_send' => function (Event $event) use ($idpName): ?Event { $event->setExtra(['idp' => $idpName]); return $event;