From 91f7e8d60a7b5ff62d91360e87cf5d8ffda87f91 Mon Sep 17 00:00:00 2001 From: Karim Ratib Date: Thu, 19 Sep 2024 14:08:38 -0700 Subject: [PATCH] WorkBC24-R6-TESTv1 (#674) * Update ecs.tf * [WBCAMS-547] Fix icons and images on card icons in mobile view * Update dependencies * [WBCAMS-547] Fix img centering and ensure svg aren't affected by changes * [NOC-482] Update dependencies * [WBCAMS-521,541,542,543] Career Trek / Video Library changes (#665) * Career Trek Video page updates * Canonical Drupal hook documentation * remove stray config settings files * Recently added * Recently added, 2 * Skills, not Skill * Button styling * Update skills field config * field_skills => field_skills_2 --------- Co-authored-by: rjkuyvenhoven * [WBCAMS-541] pass Skill name to Term loadByProperties() function. (#667) * [WBCAMS-542] Better recently added redirection * [NOC-542] Add patch to allow form redirections * [WBCAMS-543] Don't display NOC for non-career videos * [WBCAMS-542] Filter label change * SSOT Upload (to noc branch) (#669) For NOC-471, 472, 473, 475. * Update dependencies * [WBCAMS-542] Disable BigPipe completely for Career Trek page * [NOC-562] Try internal SSOT URL * [NOC-562] Enable/disable SSOT upload feature based on config setting * [NOC-562] Enable/disable SSOT upload feature based on config setting, 2 * Update main.tf * [NOC-562] Revert to using SSOT_URL env var which now points to internal URL * Merge master, 2 * Update ecs.tf (#672) * Update ecs.tf * Update ecs.tf * Update ecs.tf * Update ecs.tf * [NOC-523] Upload LMMU sheet to repo (#673) * Proof of concept * SSOT uploader queue worker * Update dependencies * Queue worker now uploads to repo * Support updating the files in the repo * [NOC-568] Upgrade dependencies * Avoid crashing when receiving invalid sheet --------- Co-authored-by: vmuchalla <148374832+vmuchalla@users.noreply.github.com> Co-authored-by: rjkuyvenhoven Co-authored-by: jinchuantang <79226696+jinchuantang@users.noreply.github.com> --- .env.example | 3 + src/composer.json | 1 + src/composer.lock | 297 ++++++++++++------ src/config/sync/core.extension.yml | 1 + .../src/Form/SsotUploadLmmuForm.php | 58 +++- .../src/Plugin/QueueWorker/SsotUploader.php | 110 +++++++ .../workbc_ssot/workbc_ssot.services.yml | 3 + src/web/sites/default/settings.aws.php | 4 +- src/web/sites/default/settings.local.php | 4 + src/web/sites/default/settings.php | 16 + terraform/dev/ecs.tf | 4 + terraform/dev2/ecs.tf | 4 + terraform/dev2/main.tf | 3 +- terraform/prod/ecs.tf | 4 + terraform/test/ecs.tf | 4 + 15 files changed, 395 insertions(+), 121 deletions(-) create mode 100644 src/web/modules/custom/workbc_ssot/src/Plugin/QueueWorker/SsotUploader.php diff --git a/.env.example b/.env.example index 2cba36241..9416a354c 100644 --- a/.env.example +++ b/.env.example @@ -25,6 +25,9 @@ DB_HOST=postgres DB_PORT=5432 DB_DRIVER=pgsql +### SSoT settings +GITHUB_API_TOKEN=TODO + ### --- MARIADB ---- MARIADB_TAG=10.7-3.19.1 diff --git a/src/composer.json b/src/composer.json index 8fb7d58c4..a18c920ee 100644 --- a/src/composer.json +++ b/src/composer.json @@ -132,6 +132,7 @@ "drupal/paragraphs_edit": "^2.0", "drupal/pathauto": "^1.10", "drupal/published_corrected_date": "^2.0", + "drupal/queue_ui": "^3.1", "drupal/recaptcha": "^3.0", "drupal/redirect": "^1.8", "drupal/redis": "^1.6", diff --git a/src/composer.lock b/src/composer.lock index e341c17cd..51eed1f53 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ae0c1ce12197037163467519fc04c17c", + "content-hash": "fa465f523fdbecdaf705391ad0c24b57", "packages": [ { "name": "alchemy/zippy", @@ -186,16 +186,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.321.3", + "version": "3.321.13", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "92e5d5fbfd3b29522b763d49d8f2fdf32e58fc1e" + "reference": "6330c3367f303ef4430fca605df9e411abe34d48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/92e5d5fbfd3b29522b763d49d8f2fdf32e58fc1e", - "reference": "92e5d5fbfd3b29522b763d49d8f2fdf32e58fc1e", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/6330c3367f303ef4430fca605df9e411abe34d48", + "reference": "6330c3367f303ef4430fca605df9e411abe34d48", "shasum": "" }, "require": { @@ -278,9 +278,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.321.3" + "source": "https://github.com/aws/aws-sdk-php/tree/3.321.13" }, - "time": "2024-09-03T18:04:21+00:00" + "time": "2024-09-17T18:08:34+00:00" }, { "name": "chi-teck/drupal-code-generator", @@ -2468,7 +2468,7 @@ "role": "Contributors" }, { - "name": "NickDickinsonWilde", + "name": "nickdickinsonwilde", "homepage": "https://www.drupal.org/user/3094661" }, { @@ -2484,7 +2484,7 @@ "homepage": "https://www.drupal.org/user/3589086" }, { - "name": "Wim Leers", + "name": "wim leers", "homepage": "https://www.drupal.org/user/99777" } ], @@ -2605,7 +2605,7 @@ "role": "Developer" }, { - "name": "DamienMcKenna", + "name": "damienmckenna", "homepage": "https://www.drupal.org/user/108450" }, { @@ -4440,7 +4440,7 @@ "role": "Maintainer" }, { - "name": "Jaypan", + "name": "jaypan", "homepage": "https://www.drupal.org/user/324696" }, { @@ -4715,7 +4715,7 @@ "homepage": "https://www.drupal.org/user/279352" }, { - "name": "Neslee Canil Pinto", + "name": "neslee canil pinto", "homepage": "https://www.drupal.org/user/3580850" } ], @@ -4816,13 +4816,21 @@ ], "authors": [ { - "name": "Anybody", + "name": "anybody", "homepage": "https://www.drupal.org/user/291091" }, { - "name": "Hydra", + "name": "grevil", + "homepage": "https://www.drupal.org/user/3668491" + }, + { + "name": "hydra", "homepage": "https://www.drupal.org/user/647364" }, + { + "name": "joevagyok", + "homepage": "https://www.drupal.org/user/2876343" + }, { "name": "jyve", "homepage": "https://www.drupal.org/user/591438" @@ -5093,17 +5101,17 @@ }, { "name": "drupal/fullcalendar_view", - "version": "5.2.2", + "version": "5.2.3", "source": { "type": "git", "url": "https://git.drupalcode.org/project/fullcalendar_view.git", - "reference": "5.2.2" + "reference": "5.2.3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/fullcalendar_view-5.2.2.zip", - "reference": "5.2.2", - "shasum": "d51ef0c53854c7cbaef8e598cd25c45c1dc6f3ab" + "url": "https://ftp.drupal.org/files/projects/fullcalendar_view-5.2.3.zip", + "reference": "5.2.3", + "shasum": "4840371fa77d335038651c6e56885671eba6d5da" }, "require": { "drupal/core": "^9.2.0 || ^10 || ^11" @@ -5111,8 +5119,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "5.2.2", - "datestamp": "1725153975", + "version": "5.2.3", + "datestamp": "1726662266", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5752,7 +5760,7 @@ ], "authors": [ { - "name": "Cellar Door", + "name": "cellar door", "homepage": "https://www.drupal.org/user/658076" }, { @@ -6334,7 +6342,7 @@ "role": "Developer" }, { - "name": "Dave Reid", + "name": "dave reid", "homepage": "https://www.drupal.org/user/53892" } ], @@ -6772,6 +6780,89 @@ "source": "https://git.drupalcode.org/project/published_corrected_date" } }, + { + "name": "drupal/queue_ui", + "version": "3.1.4", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/queue_ui.git", + "reference": "3.1.4" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/queue_ui-3.1.4.zip", + "reference": "3.1.4", + "shasum": "a701e551683b2b026f4223ac81a6f5a3c34eedcb" + }, + "require": { + "drupal/core": "^9.2 || ^10" + }, + "require-dev": { + "drupal/queue_order": "^2" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "3.1.4", + "datestamp": "1708276956", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + }, + "drush": { + "services": { + "drush.services.yml": "^9 || ^10 || ^11" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "floretan", + "homepage": "https://www.drupal.org/user/2743951", + "role": "Maintainer" + }, + { + "name": "coltrane", + "homepage": "https://www.drupal.org/user/91990", + "role": "Maintainer" + }, + { + "name": "tsphethean", + "homepage": "https://www.drupal.org/user/66163", + "role": "Maintainer" + }, + { + "name": "bceyssens", + "homepage": "https://www.drupal.org/user/2811585", + "role": "Maintainer" + }, + { + "name": "voleger", + "homepage": "https://www.drupal.org/user/881620", + "role": "Maintainer" + }, + { + "name": "voleger", + "homepage": "https://www.drupal.org/user/3260314" + } + ], + "description": "Interface and manager for Drupal queues.", + "homepage": "https://www.drupal.org/project/queue_ui", + "keywords": [ + "drupal", + "php", + "queue" + ], + "support": { + "source": "https://git.drupalcode.org/project/queue_ui", + "issues": "https://www.drupal.org/project/issues/queue_ui" + } + }, { "name": "drupal/recaptcha", "version": "3.2.0", @@ -7123,7 +7214,11 @@ "role": "Maintainer" }, { - "name": "JeroenT", + "name": "benjy", + "homepage": "https://www.drupal.org/user/1852732" + }, + { + "name": "jeroent", "homepage": "https://www.drupal.org/user/2228934" } ], @@ -7411,7 +7506,7 @@ "homepage": "https://www.drupal.org/user/124705" }, { - "name": "Nick_vh", + "name": "nick_vh", "homepage": "https://www.drupal.org/user/122682" } ], @@ -7465,7 +7560,7 @@ "homepage": "https://www.drupal.org/user/56348" }, { - "name": "Neslee Canil Pinto", + "name": "neslee canil pinto", "homepage": "https://www.drupal.org/user/3580850" } ], @@ -7782,6 +7877,10 @@ { "name": "lostkoder", "homepage": "https://www.drupal.org/user/3545132" + }, + { + "name": "sickness29", + "homepage": "https://www.drupal.org/user/2586096" } ], "description": "Provides 'Time Field' and 'Time Range Field'.", @@ -8099,7 +8198,7 @@ "homepage": "https://www.drupal.org/u/graber" }, { - "name": "Graber", + "name": "graber", "homepage": "https://www.drupal.org/user/1599440" }, { @@ -8403,7 +8502,7 @@ "role": "Contributor" }, { - "name": "Liam Morland", + "name": "liam morland", "homepage": "https://www.drupal.org/user/493050" }, { @@ -8704,25 +8803,25 @@ }, { "name": "enshrined/svg-sanitize", - "version": "0.19.0", + "version": "0.20.0", "source": { "type": "git", "url": "https://github.com/darylldoyle/svg-sanitizer.git", - "reference": "e95cd17be68e45f523cbfb0fe50cdd891b0cf20e" + "reference": "068d9fcf912c88a0471d101d95a2caa87c50aee7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/e95cd17be68e45f523cbfb0fe50cdd891b0cf20e", - "reference": "e95cd17be68e45f523cbfb0fe50cdd891b0cf20e", + "url": "https://api.github.com/repos/darylldoyle/svg-sanitizer/zipball/068d9fcf912c88a0471d101d95a2caa87c50aee7", + "reference": "068d9fcf912c88a0471d101d95a2caa87c50aee7", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", - "php": "^5.6 || ^7.0 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.5 || ^8.5" + "phpunit/phpunit": "^6.5 || ^8.5" }, "type": "library", "autoload": { @@ -8743,9 +8842,9 @@ "description": "An SVG sanitizer for PHP", "support": { "issues": "https://github.com/darylldoyle/svg-sanitizer/issues", - "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.19.0" + "source": "https://github.com/darylldoyle/svg-sanitizer/tree/0.20.0" }, - "time": "2024-06-18T10:27:15+00:00" + "time": "2024-09-05T10:18:12+00:00" }, { "name": "frdh/mmenu-js", @@ -9604,20 +9703,20 @@ }, { "name": "longwave/laminas-diactoros", - "version": "2.14.2", + "version": "2.14.3", "source": { "type": "git", "url": "https://github.com/longwave/laminas-diactoros.git", - "reference": "ae4f0becf249ae8eea8f2f8f9fb927104e55a885" + "reference": "2bd6b47a090ae924ecc298657d01f8a462f7507b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/longwave/laminas-diactoros/zipball/ae4f0becf249ae8eea8f2f8f9fb927104e55a885", - "reference": "ae4f0becf249ae8eea8f2f8f9fb927104e55a885", + "url": "https://api.github.com/repos/longwave/laminas-diactoros/zipball/2bd6b47a090ae924ecc298657d01f8a462f7507b", + "reference": "2bd6b47a090ae924ecc298657d01f8a462f7507b", "shasum": "" }, "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "php": "^7.3 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0" }, @@ -9696,7 +9795,7 @@ "rss": "https://github.com/laminas/laminas-diactoros/releases.atom", "source": "https://github.com/laminas/laminas-diactoros" }, - "time": "2023-04-26T21:27:14+00:00" + "time": "2024-09-11T14:26:18+00:00" }, { "name": "maennchen/zipstream-php", @@ -10013,16 +10112,16 @@ }, { "name": "mtdowling/jmespath.php", - "version": "2.7.0", + "version": "2.8.0", "source": { "type": "git", "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b" + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/bbb69a935c2cbb0c03d7f481a238027430f6440b", - "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc", + "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc", "shasum": "" }, "require": { @@ -10039,7 +10138,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -10073,22 +10172,22 @@ ], "support": { "issues": "https://github.com/jmespath/jmespath.php/issues", - "source": "https://github.com/jmespath/jmespath.php/tree/2.7.0" + "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0" }, - "time": "2023-08-25T10:54:48+00:00" + "time": "2024-09-04T18:46:31+00:00" }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -10131,9 +10230,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "pear/archive_tar", @@ -11152,16 +11251,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { @@ -11228,7 +11327,7 @@ "type": "open_collective" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-09-18T10:38:58+00:00" }, { "name": "stack/builder", @@ -13022,20 +13121,20 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", - "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", + "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -13080,7 +13179,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0" }, "funding": [ { @@ -13096,7 +13195,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-idn", @@ -13354,36 +13453,28 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "10112722600777e02d2745716b70c5db4ca70442" + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", - "reference": "10112722600777e02d2745716b70c5db4ca70442", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", + "reference": "fa2ae56c44f03bed91a39bfc9822e31e7c5c38ce", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, - "type": "library", + "type": "metapackage", "extra": { "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" } }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -13407,7 +13498,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.31.0" }, "funding": [ { @@ -13423,24 +13514,24 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1" + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/ec444d3f3f6505bb28d11afa41e75faadebc10a1", - "reference": "ec444d3f3f6505bb28d11afa41e75faadebc10a1", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb", + "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -13483,7 +13574,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0" }, "funding": [ { @@ -13499,7 +13590,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", @@ -13586,20 +13677,20 @@ }, { "name": "symfony/polyfill-php81", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -13642,7 +13733,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -13658,7 +13749,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/process", @@ -16743,16 +16834,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.30.0", + "version": "1.30.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f" + "reference": "51b95ec8670af41009e2b2b56873bad96682413e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/5ceb0e384997db59f38774bf79c2a6134252c08f", - "reference": "5ceb0e384997db59f38774bf79c2a6134252c08f", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e", + "reference": "51b95ec8670af41009e2b2b56873bad96682413e", "shasum": "" }, "require": { @@ -16784,9 +16875,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1" }, - "time": "2024-08-29T09:54:52+00:00" + "time": "2024-09-07T20:13:05+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/src/config/sync/core.extension.yml b/src/config/sync/core.extension.yml index 716b6a2f2..bf58679b0 100644 --- a/src/config/sync/core.extension.yml +++ b/src/config/sync/core.extension.yml @@ -110,6 +110,7 @@ module: path_alias: 0 pgsql: 0 published_corrected_date: 0 + queue_ui: 0 rdf: 0 recaptcha: 0 redirect: 0 diff --git a/src/web/modules/custom/workbc_ssot/src/Form/SsotUploadLmmuForm.php b/src/web/modules/custom/workbc_ssot/src/Form/SsotUploadLmmuForm.php index b6bf427b6..e7d6539ff 100644 --- a/src/web/modules/custom/workbc_ssot/src/Form/SsotUploadLmmuForm.php +++ b/src/web/modules/custom/workbc_ssot/src/Form/SsotUploadLmmuForm.php @@ -284,7 +284,7 @@ public function getDescription() } } } - return $this->t('This action will update the SSOT Labour Market Monthly Update for @month @year.', [ + return $this->t('This action will update the SSoT Labour Market Monthly Update for @month @year.', [ '@month' => DateHelper::monthNames(true)[$this->monthly_labour_market_updates['month']], '@year' => $this->monthly_labour_market_updates['year'] ]); @@ -417,16 +417,25 @@ public function validateForm(array &$form, FormStateInterface $form_state) } // Get the previous month dataset to compare some cells. - $date = ExcelDate::excelToDateTimeObject($sheet->getCell('A3')->getValue()); - $previous_year = $date->format('Y') + 0; - $previous_month = $date->format('n') - 1; - if ($previous_month == 0) { - $previous_month = 12; - $previous_year -= 1; + try { + $date = ExcelDate::excelToDateTimeObject($sheet->getCell('A3')->getValue()); + $previous_year = $date->format('Y') + 0; + $previous_month = $date->format('n') - 1; + if ($previous_month == 0) { + $previous_month = 12; + $previous_year -= 1; + } + $previous_month = json_decode($this->ssot("monthly_labour_market_updates?year=eq.$previous_year&month=eq.$previous_month")->getBody(), true); + if (!empty($previous_month)) { + $previous_month = reset($previous_month); + } } - $previous_month = json_decode($this->ssot("monthly_labour_market_updates?year=eq.$previous_year&month=eq.$previous_month")->getBody(), true); - if (!empty($previous_month)) { - $previous_month = reset($previous_month); + catch (\TypeError $e) { + \Drupal::logger('workbc_ssot')->error('Error validating @name: @error', [ + '@name' => $name, '@error' => $e->getMessage() + ]); + $form_state->setErrorByName('lmmu', $this->t('❌ This spreadsheet file is likely invalid. Please refer to the logs for more information.')); + return; } // Validate and fill the monthly_labour_market_updates values. @@ -451,8 +460,13 @@ public function validateForm(array &$form, FormStateInterface $form_state) if (array_key_exists('type', $validation)) { switch ($validation['type']) { case 'date_year': - $date = ExcelDate::excelToDateTimeObject($sheet->getCell($validation['cell'])->getValue()); - if ($date->format('Y') != $value) { + try { + $date = ExcelDate::excelToDateTimeObject($sheet->getCell($validation['cell'])->getValue()); + } + catch (\TypeError $e) { + $date = null; + } + if (!empty($date) && $date->format('Y') != $value) { array_key_push($errors, $key, $this->t('❌ Cell @cell (@key = @value) does not conform to: @explanation @suggestion', [ '@cell' => $validation['cell'], '@key' => $key, @@ -463,8 +477,13 @@ public function validateForm(array &$form, FormStateInterface $form_state) } break; case 'date_month': - $date = ExcelDate::excelToDateTimeObject($sheet->getCell($validation['cell'])->getValue()); - if ($date->format('n') != $value) { + try { + $date = ExcelDate::excelToDateTimeObject($sheet->getCell($validation['cell'])->getValue()); + } + catch (\TypeError $e) { + $date = null; + } + if (!empty($date) && $date->format('n') != $value) { array_key_push($errors, $key, $this->t('❌ Cell @cell (@key = @value) does not conform to: @explanation @suggestion', [ '@cell' => $validation['cell'], '@key' => $key, @@ -660,7 +679,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) } // Mark the file as permanent. - $file = \Drupal\file\Entity\File::load($form_state->get('file_id')); + $file = File::load($form_state->get('file_id')); $file->setPermanent(); $file->save(); @@ -688,6 +707,15 @@ public function submitForm(array &$form, FormStateInterface $form_state) ->condition('oid', $log_id, '<>') ->execute(); + // Enqueue a job to update the SSoT repo. + \Drupal::queue('ssot_uploader')->createItem([ + 'file_id' => $form_state->get('file_id'), + 'month' => $month, + 'year' => $year, + 'notes' => $form_state->get('notes'), + 'uid' => \Drupal::currentUser()->id(), + ]); + \Drupal::messenger()->addMessage(t('Labour Market Monthly Update successfully updated for @month @year. Click here to see it!', [ '@year' => $year, '@month' => DateHelper::monthNames(true)[$month], diff --git a/src/web/modules/custom/workbc_ssot/src/Plugin/QueueWorker/SsotUploader.php b/src/web/modules/custom/workbc_ssot/src/Plugin/QueueWorker/SsotUploader.php new file mode 100644 index 000000000..7e194b559 --- /dev/null +++ b/src/web/modules/custom/workbc_ssot/src/Plugin/QueueWorker/SsotUploader.php @@ -0,0 +1,110 @@ +getFilename(); + $repo = \Drupal::config('workbc')->get('ssot_repo'); + $filepath = \Drupal::service('file_system')->realpath($file->getFileUri()); + \Drupal::logger('workbc')->notice('Uploading SSoT LMMU sheet @sheet for @month/@year.', [ + '@sheet' => $sheet, + '@month' => $data['month'], + '@year' => $data['year'], + ]); + Timer::start('ssot_uploader'); + + // First get the sha of the existing file if any. + try { + $existing = $this->github("https://api.github.com/repos/{$repo['name']}/contents/{$repo['path']}/{$sheet}?ref=" . $repo['branches'][getenv('PROJECT_ENVIRONMENT')], 'GET', $repo['token']); + $sha = json_decode($existing->getBody())->sha; + } + catch (\Exception $e) { + $sha = null; + } + + // Create / update the file. + $this->github("https://api.github.com/repos/{$repo['name']}/contents/{$repo['path']}/{$sheet}", 'PUT', $repo['token'], [ + 'branch' => $repo['branches'][getenv('PROJECT_ENVIRONMENT')], + 'sha' => $sha, + 'content' => base64_encode(file_get_contents($filepath)), + 'committer' => [ + 'name' => $repo['committer'], + 'email' => \Drupal::config('system.site')->get('mail'), + ], + 'author' => [ + 'name' => User::load($data['uid'])->getDisplayName(), + 'email' => \Drupal::config('system.site')->get('mail'), + ], + 'message' => $data['notes'], + ]); + + Timer::stop('ssot_uploader'); + \Drupal::logger('workbc')->notice('Done uploading SSoT LMMU sheet @sheet in @time.', [ + '@sheet' => $sheet, + '@time' => Timer::read('ssot_uploader') . 'ms' + ]); + } + + private function github($endpoint, $method, $token, $body = null) { + $client = new Client(); + $options = [ + 'headers' => [ + 'Accept' => 'application/vnd.github+json', + 'Authorization' => "Bearer {$token}", + 'X-GitHub-Api-Version' => '2022-11-28', + ] + ]; + if (!empty($body)) { + $options['json'] = $body; + } + return $client->request($method, $endpoint, $options); + } +} diff --git a/src/web/modules/custom/workbc_ssot/workbc_ssot.services.yml b/src/web/modules/custom/workbc_ssot/workbc_ssot.services.yml index 128e6781d..020e7006f 100644 --- a/src/web/modules/custom/workbc_ssot/workbc_ssot.services.yml +++ b/src/web/modules/custom/workbc_ssot/workbc_ssot.services.yml @@ -3,3 +3,6 @@ services: class: Drupal\workbc_ssot\Routing\SSotFeatureRouteSubscriber tags: - { name: event_subscriber } + + workbc_ssot.queue_worker: + class: Drupal\workbc_ssot\Plugin\QueueWorker\SsotUploader diff --git a/src/web/sites/default/settings.aws.php b/src/web/sites/default/settings.aws.php index 496059988..86e78f45b 100644 --- a/src/web/sites/default/settings.aws.php +++ b/src/web/sites/default/settings.aws.php @@ -40,7 +40,7 @@ $config['system.mail']['interface']['webform'] = 'ses_mail'; // Single Source of Truth (SSoT) configuration. -$config['workbc']['ssot_url'] = getenv('PROJECT_ENVIRONMENT') === 'aws-dev-noc' ? 'http://internal-ssot-lb-935724506.ca-central-1.elb.amazonaws.com:3000/' : getenv('SSOT_URL'); +$config['workbc']['ssot_url'] = getenv('SSOT_URL'); $config['jobboard']['jobboard_api_url_frontend'] = getenv('JOBBOARD_API_URL'); $config['jobboard']['jobboard_api_url_backend'] = getenv('JOBBOARD_API_INTERNAL_URL'); @@ -53,4 +53,4 @@ $config['workbc']['careertrek_url'] = getenv('CAREERTREK_URL'); // Enable/disable features -$config['workbc']['features']['ssot_upload'] = FALSE; +$config['workbc']['features']['ssot_upload'] = TRUE; diff --git a/src/web/sites/default/settings.local.php b/src/web/sites/default/settings.local.php index 846e7d228..f80c2113c 100644 --- a/src/web/sites/default/settings.local.php +++ b/src/web/sites/default/settings.local.php @@ -271,6 +271,10 @@ // Career Trek configuration $config['workbc']['careertrek_url'] = getenv('CAREERTREK_URL') ?: 'https://careertrekbc.ca'; +// SSoT settings. +$config['workbc']['ssot_repo']['name'] = 'infojunkie/workbc-ssot'; +$config['workbc']['ssot_repo']['branches']['dev'] = 'dev'; + // Enable/disable features $config['workbc']['features']['ssot_upload'] = TRUE; diff --git a/src/web/sites/default/settings.php b/src/web/sites/default/settings.php index 11871f9f0..ac0e5dc10 100644 --- a/src/web/sites/default/settings.php +++ b/src/web/sites/default/settings.php @@ -792,6 +792,22 @@ $config['jobboard']['find_job_account_url'] = '/account'; $config['jobboard']['sha'] = 'ed922428a5da171ed7463d27f111bbd55a4b0d2d'; +// SSoT settings. +$config['workbc']['ssot_repo'] = [ + 'name' => 'bcgov/workbc-ssot', + 'path' => 'migration/data', + 'branches' => [ + 'dev' => 'noc', + 'local' => 'noc', + 'aws-dev' => 'noc', + 'aws-dev-noc' => 'noc', + 'aws-test' => 'noc', + 'aws-prod' => 'master', + ], + 'token' => getenv('GITHUB_API_TOKEN'), + 'committer' => 'WorkBC SSoT Uploader', +]; + // File settings. $config['file.settings']['make_unused_managed_files_temporary'] = TRUE; diff --git a/terraform/dev/ecs.tf b/terraform/dev/ecs.tf index 4bf43abee..1d7321896 100644 --- a/terraform/dev/ecs.tf +++ b/terraform/dev/ecs.tf @@ -183,6 +183,10 @@ resource "aws_ecs_task_definition" "app" { { name = "LMMU_USERNAME", valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:lmmu_username::" + }, + { + name = "GITHUB_API_TOKEN", + valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:github_api_token::" } ] diff --git a/terraform/dev2/ecs.tf b/terraform/dev2/ecs.tf index 7edd7baf9..c7e83b2c7 100644 --- a/terraform/dev2/ecs.tf +++ b/terraform/dev2/ecs.tf @@ -171,6 +171,10 @@ resource "aws_ecs_task_definition" "app" { { name = "LMMU_USERNAME", valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:lmmu_username::" + }, + { + name = "GITHUB_API_TOKEN", + valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:github_api_token::" } ] diff --git a/terraform/dev2/main.tf b/terraform/dev2/main.tf index a15cfed5c..8aa4d3413 100644 --- a/terraform/dev2/main.tf +++ b/terraform/dev2/main.tf @@ -3,7 +3,8 @@ locals { common_tags = var.common_tags create_ecs_service = var.app_image == "" ? 0 : 1 #conn_str = "http://${data.aws_alb.ssot2.dns_name}:3000" - conn_str = "https://workbc-ssot.b89n0c-dev.nimbus.cloud.gov.bc.ca" + conn_str = "http://${data.aws_alb.ssot.dns_name}:3000" + #conn_str = "https://workbc-ssot.b89n0c-dev.nimbus.cloud.gov.bc.ca" jb_api_url = "https://devnoc-api-jobboard.workbc.ca" jb_api_internal_url = "https://workbc-jb-noc.b89n0c-dev.nimbus.cloud.gov.bc.ca" } diff --git a/terraform/prod/ecs.tf b/terraform/prod/ecs.tf index d0eb3fc43..81a29d33f 100644 --- a/terraform/prod/ecs.tf +++ b/terraform/prod/ecs.tf @@ -163,6 +163,10 @@ resource "aws_ecs_task_definition" "app" { { name = "DRUPAL_ADM_PWD", valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:drupal_adm_password::" + }, + { + name = "GITHUB_API_TOKEN", + valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:github_api_token::" } ] diff --git a/terraform/test/ecs.tf b/terraform/test/ecs.tf index fbce35611..f4c19a01c 100644 --- a/terraform/test/ecs.tf +++ b/terraform/test/ecs.tf @@ -163,6 +163,10 @@ resource "aws_ecs_task_definition" "app" { { name = "DRUPAL_ADM_PWD", valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:drupal_adm_password::" + }, + { + name = "GITHUB_API_TOKEN", + valueFrom = "${data.aws_secretsmanager_secret_version.creds.arn}:github_api_token::" } ]