Skip to content

Commit

Permalink
Merge pull request #77 from adam-vessey/fix/config-enforcement
Browse files Browse the repository at this point in the history
Sunsetting: Remove config enforcement, and post-update hook to do so for existing sites
  • Loading branch information
bibliophileaxe authored Oct 31, 2022
2 parents 443fca7 + d252083 commit a875fa9
Show file tree
Hide file tree
Showing 26 changed files with 380 additions and 71 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/build-3.x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the target branch
push:
branches: [ 3.x ]
pull_request:
branches: [ 3.x ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ["7.4", "8.0", "8.1"]
drupal-version: ["9.3.x", "9.4.x", "9.5.x-dev"]
mysql: ["8.0"]
include:
- allowed_failure: "false"
- php-versions: "8.1"
allowed_failure: "true"

name: PHP ${{ matrix.php-versions }} | drupal ${{ matrix.drupal-version }} | mysql ${{ matrix.mysql }}
services:
mysql:
image: mysql:${{ matrix.mysql }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: drupal
ports:
- 3306:3306
activemq:
image: webcenter/activemq:5.14.3
ports:
- 8161:8161
- 61616:61616
- 61613:61613

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v2
with:
path: build_dir

- name: Checkout islandora_ci
uses: actions/checkout@v2
with:
repository: islandora/islandora_ci
ref: github-actions
path: islandora_ci

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2

- name: Setup Mysql client
run: |
sudo apt-get update
sudo apt-get remove -y mysql-client mysql-common
sudo apt-get install -y mysql-client
- name: Update Packages
run: |
sudo apt-get update
- name: Set environment variables
run: |
echo "DRUPAL_VERSION=${{ matrix.drupal-version }}" >> $GITHUB_ENV
echo "SCRIPT_DIR=$GITHUB_WORKSPACE/islandora_ci" >> $GITHUB_ENV
echo "DRUPAL_DIR=/opt/drupal" >> $GITHUB_ENV
echo "PHPUNIT_FILE=$GITHUB_WORKSPACE/build_dir/phpunit.xml" >> $GITHUB_ENV
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- name: Setup Drupal
run: |
mkdir $DRUPAL_DIR
$SCRIPT_DIR/travis_setup_drupal.sh
cd $DRUPAL_DIR
chmod -R u+w web/sites/default
mkdir -p web/sites/simpletest/browser_output
continue-on-error: ${{ matrix.allowed_failure }}

- name: Setup composer paths
run: |
git -C "$GITHUB_WORKSPACE/build_dir" checkout -b github-testing
cd $DRUPAL_DIR
composer config repositories.local path "$GITHUB_WORKSPACE/build_dir"
composer config minimum-stability dev
composer require "islandora/islandora:^2"
composer require "drupal/search_api_solr:^4.1"
composer require "islandora/islandora_defaults:dev-github-testing as 3.x-dev" --prefer-source -W
- name: Install modules
run: |
cd $DRUPAL_DIR/web
drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults islandora_search
drush --uri=127.0.0.1:8282 fim -y islandora_core_feature,islandora_text_extraction_defaults,islandora_defaults,islandora_search
- name: Test scripts
run: $SCRIPT_DIR/travis_scripts.sh

198 changes: 196 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,201 @@

## Future Development

Islandora Defaults is no longer under active development. Its core purpose is being superceded by a project to create an example Starter Site. You can read the announcement [here](https://groups.google.com/u/1/g/islandora/c/uGzhTnW4TUI).
Islandora Defaults is no longer under active development, and is being deprecated. Its core purpose is being (and has been) superseded by a project to create an example Starter Site, which [exists in the `islandora-starter-site` repository](https://github.com/Islandora/islandora-starter-site). You can read the announcement [here](https://groups.google.com/u/1/g/islandora/c/uGzhTnW4TUI).

### Deprecation/Removal Preparation

To ease the removal of this module from existing installations, we have implemented a post-update hook which should remove any references to this module from configuration entities that it installed. To make use of it, it should be sufficient to update to the `islandora/islandora_defaults` package in your Drupal project such that it includes the new hook, and to run it. On the CLI, this might be effected as something like:

```bash
# Navigate to the root of your Composer project; for example:
cd /var/www/html/drupal

# Update islandora/islandora_defaults such that it has the post-update hooks
# available. Presently anticipating a "3.0.1" release to which it should update.
composer require "islandora/islandora_defaults:^3"
# A caveat exists in that, if `islandora/islandora_defaults` is required by any
# other Composer package, then those packages may have to be updated first; for
# example, it is known that there exist Drupal installation profiles that
# specify a dependency on `islandora/islandora_defaults` (such as https://github.com/Islandora-Devops/islandora_install_profile_demo/blob/181a53bb230d7ced6e70e7746f0da567216ebbf7/composer.json#L157),
# which would likely have to receive a treatment to strip out any references
# from their configurations which explicitly bind to `islandora_defaults`
# similar to our update hook, and to include updated requirements accordingly
# in the root Composer project.

# Clear cache (paranoia; to ensure the update hooks are appropriately
# discovered).
drush cr

# Run the update hook.
drush updb

# Now that our config entities should stay behind, the module itself should be
# fine to be uninstalled. Note that this should/may also result in the
# uninstallation of the islandora_oaipmh and islandora_search modules; though,
# the configurations they included should remain in the system.
drush pm-uninstall islandora_defaults

# Perform a dry-run removal to list out all that would be removed, when
# islandora/islandora_defaults is removed, as some modules may only be included
# transitively.
composer remove --dry-run islandora/islandora_defaults

# Add back some of the modules that might just be included in the project
# transitively, for example:
composer require "drupal/field_group:^3" "drupal/field_permissions:^1" \
"islandora/controlled_access_terms:^2" "islandora/islandora_mirador:^2"
# However, in the event that you indeed are not using some of these modules, you
# might instead proceed to ensure that they are uninstalled from Drupal, similar
# to the "drush pm-uninstall" invocation above. For the version specs to use, it
# may be useful to refer to what the our `composer.json` specifies.

# Remove the package from the project entirely.
composer remove islandora/islandora_defaults

# Clear the caches, for cleanup/paranoia.
drush cr

# Restart your webserver to register the movement of islandora_mirador from
# submodule to a module in its own right; otherwise, caching of class
# definitions might lead to errors. The command might look something like:
sudo systemctl restart apache2
```

<details>
<summary>With output in context, what this might look like</summary>

This was executed on a revived `standard` instance of `islandora-playbook`, with
some very minor preparation to work around the fact that the update hook code
did not yet exist in released code (and so had to point at the development
branch (`dev-fix/config-enforcement`) and made use of aliases accordingly (
`[...] as 3.x-dev`)). When running post-release, the version spec `^3` should be
able to be used instead.

```
vagrant@islandora8:~$ cd /var/www/html/drupal
vagrant@islandora8:/var/www/html/drupal$ composer require "islandora/islandora_defaults:dev-fix/config-enforcement as 3.x-dev"
./composer.json has been updated
Running composer update islandora/islandora_defaults
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 1 install, 1 update, 0 removals
- Upgrading islandora/islandora_defaults (2.1.1 => dev-fix/config-enforcement dac37d2)
- Locking islandora/islandora_mirador (2.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 1 update, 0 removals
- Downloading islandora/islandora_mirador (2.2.1)
- Downloading islandora/islandora_defaults (dev-fix/config-enforcement dac37d2)
- Installing islandora/islandora_mirador (2.2.1): Extracting archive
- Upgrading islandora/islandora_defaults (2.1.1 => dev-fix/config-enforcement dac37d2): Extracting archive
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package silex/silex is abandoned, you should avoid using it. Use symfony/flex instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
Generating autoload files
68 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
vagrant@islandora8:/var/www/html/drupal$ drush cr
[warning] Illegal string offset 'label' OaiPmh.php:116
[warning] Illegal string offset 'value' OaiPmh.php:116
[warning] Illegal string offset 'label' OaiPmh.php:116
[warning] Illegal string offset 'value' OaiPmh.php:116
[success] Cache rebuild complete.
vagrant@islandora8:/var/www/html/drupal$ drush updb
-------------------- ------------- ------------- ---------------------------
Module Update ID Type Description
-------------------- ------------- ------------- ---------------------------
islandora_defaults remove_enfo post-update Remove "enforced"
rced_depend dependency on this module
ency from installed config.
-------------------- ------------- ------------- ---------------------------
Do you wish to run the specified pending updates? (yes/no) [yes]:
>
> [notice] Update started: islandora_defaults_post_update_remove_enforced_dependency
> [notice] Update completed: islandora_defaults_post_update_remove_enforced_dependency
> [warning] Illegal string offset 'label' OaiPmh.php:116
> [warning] Illegal string offset 'value' OaiPmh.php:116
> [warning] Illegal string offset 'label' OaiPmh.php:116
> [warning] Illegal string offset 'value' OaiPmh.php:116
[success] Finished performing updates.
vagrant@islandora8:/var/www/html/drupal$ drush pm-uninstall islandora_defaults
The following extensions will be uninstalled: islandora_defaults, islandora_oaipmh, islandora_search
Do you want to continue? (yes/no) [yes]:
>
[warning] Illegal string offset 'label' OaiPmh.php:116
[warning] Illegal string offset 'value' OaiPmh.php:116
[warning] Illegal string offset 'label' OaiPmh.php:116
[warning] Illegal string offset 'value' OaiPmh.php:116
[success] Successfully uninstalled: islandora_defaults, islandora_oaipmh, islandora_search
vagrant@islandora8:/var/www/html/drupal$ composer require "drupal/field_group:^3" "drupal/field_permissions:^1" "islandora/controlled_access_terms:^2" "islandora/islandora_mirador:^2"
./composer.json has been updated
Running composer update drupal/field_group drupal/field_permissions islandora/controlled_access_terms islandora/islandora_mirador
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 0 removals
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package silex/silex is abandoned, you should avoid using it. Use symfony/flex instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
Generating autoload files
68 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
vagrant@islandora8:/var/www/html/drupal$ composer remove islandora/islandora_defaults
./composer.json has been updated
Running composer update islandora/islandora_defaults
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 1 removal
- Removing islandora/islandora_defaults (dev-fix/config-enforcement dac37d2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
- Removing islandora/islandora_defaults (dev-fix/config-enforcement dac37d2)
Deleting web/modules/contrib/islandora_defaults - deleted
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package silex/silex is abandoned, you should avoid using it. Use symfony/flex instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
Generating autoload files
68 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
vagrant@islandora8:/var/www/html/drupal$ drush cr
[warning] Illegal string offset 'label' OaiPmh.php:116
[warning] Illegal string offset 'value' OaiPmh.php:116
[warning] Illegal string offset 'label' OaiPmh.php:116
[warning] Illegal string offset 'value' OaiPmh.php:116
[success] Cache rebuild complete.
vagrant@islandora8:/var/www/html/drupal$ sudo systemctl restart apache2
vagrant@islandora8:/var/www/html/drupal$
```

The warnings:

```
[warning] Illegal string offset 'label' OaiPmh.php:116
[warning] Illegal string offset 'value' OaiPmh.php:116
```

... are from `islandora_defaults` shipping configuration for an older schema
([commit which changed it](https://git.drupalcode.org/project/rest_oai_pmh/-/commit/784d827eb77cd2513b66054b31b7dfae54f469c2))
of the [REST OAI-PMH module](https://www.drupal.org/project/rest_oai_pmh), of
which it is outside the scope of present efforts to address.

</details>

---

## Introduction

Expand All @@ -30,7 +224,7 @@ Further [documentation for this module](https://islandora.github.io/documentatio

## Troubleshooting/Issues

Having problems or solved a problem? Check out the Islandora google groups for a solution.
Having problems or solved a problem? Check out the Islandora Google Groups for a solution.

* [Islandora Group](https://groups.google.com/forum/?hl=en&fromgroups#!forum/islandora)

Expand Down
3 changes: 0 additions & 3 deletions config/install/context.context.binary.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
langcode: en
status: true
dependencies:
enforced:
module:
- islandora_defaults
module:
- islandora
name: binary
Expand Down
3 changes: 0 additions & 3 deletions config/install/context.context.collection.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
langcode: en
status: true
dependencies:
enforced:
module:
- islandora_defaults
module:
- islandora
name: collection
Expand Down
3 changes: 0 additions & 3 deletions config/install/context.context.repository_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ dependencies:
module:
- islandora
- node
enforced:
module:
- islandora_defaults
label: Content
name: repository_content
group: Indexing
Expand Down
3 changes: 0 additions & 3 deletions config/install/context.context.taxonomy_terms.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
langcode: en
status: true
dependencies:
enforced:
module:
- islandora_defaults
module:
- islandora
name: taxonomy_terms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ dependencies:
- field.field.node.islandora_object.field_temporal_subject
- field.field.node.islandora_object.field_weight
- node.type.islandora_object
enforced:
module:
- islandora_defaults
module:
- controlled_access_terms
- field_group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ dependencies:
- field.field.media.file.field_mime_type
- field.field.media.file.field_original_name
- media.type.file
enforced:
module:
- islandora_defaults
module:
- openseadragon
id: media.file.open_seadragon
Expand Down
Loading

0 comments on commit a875fa9

Please sign in to comment.