-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate CWRC image updating from leaf-base-i8: first draft
- Loading branch information
Showing
11 changed files
with
466 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"variable": { | ||
"LEAF_VERSION": { | ||
"default": "3.0.18" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# syntax=docker/dockerfile:1.5.1 | ||
FROM python:3.12-alpine | ||
|
||
ARG \ | ||
TARGETARCH \ | ||
LEAF_VERSION | ||
|
||
|
||
ENV \ | ||
LEAF_VERSION ${LEAF_VERSION} | ||
|
||
|
||
# Copy local customizations | ||
COPY --link docker/drupal/scripts /scripts/ | ||
|
||
COPY --link docker-bake-leaf-version-override.json /tmp/docker-bake-leaf-version-override.json | ||
|
||
# Update docker-bake with the specified LEAF version | ||
# * core.extension | ||
RUN --mount=type=cache,id=custom-drupal-composer-${TARGETARCH},sharing=locked,target=/root/.composer/cache \ | ||
export VIRTUAL_ENV=venv && \ | ||
python -m venv ${VIRTUAL_ENV} && \ | ||
source ${VIRTUAL_ENV}/bin/activate && \ | ||
python -m pip install python-hcl2 && \ | ||
echo "Running ${LEAF_VERSION}" && \ | ||
python /scripts/leaf_version_bake.py \ | ||
--src /tmp/docker-bake-leaf-version-override.json \ | ||
--value "${LEAF_VERSION}" | ||
|
||
# export PATH=$PATH:/scripts/merge_cwrc/bin && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# syntax=docker/dockerfile:1.5.1 | ||
FROM python:3.12-alpine | ||
|
||
ARG TARGETARCH | ||
|
||
# Copy local customizations | ||
COPY --link scripts /scripts/ | ||
|
||
COPY --link rootfs / | ||
|
||
|
||
# Add CWRC customizations to | ||
# * core.extension | ||
RUN --mount=type=cache,id=custom-drupal-composer-${TARGETARCH},sharing=locked,target=/root/.composer/cache \ | ||
export VIRTUAL_ENV=/scripts/merge_cwrc_venv && \ | ||
python -m venv ${VIRTUAL_ENV} && \ | ||
source ${VIRTUAL_ENV}/bin/activate && \ | ||
python -m pip install pyyaml && \ | ||
python /scripts/merge_cwrc_customizations_drupal_core_extensions_yaml.py \ | ||
--input /scripts/core.extension_cwrc_customizations_template.yml \ | ||
--input /var/www/drupal/config/sync/core.extension.yml \ | ||
--output /tmp/core.extension.yml | ||
|
||
# export PATH=$PATH:/scripts/merge_cwrc/bin && \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# UV | ||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
#uv.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control | ||
.pdm.toml | ||
.pdm-python | ||
.pdm-build/ | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
#.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
# Get remote LEAF tag | ||
LEAF_VERSION=$( | ||
git ls-remote --tags https://gitlab.com/calincs/cwrc/leaf/leaf-base-i8.git | \ | ||
awk -F/ '{print $NF}' | \ | ||
grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | \ | ||
sort -V | \ | ||
tail -n1 | ||
) | ||
echo $LEAF_VERSION | ||
|
||
# Check Docker Buildx Bake | ||
# If TAG and bake var different then update | ||
export FROM=ghcr.io/cwrc/leaf-version-update-helper:local | ||
LEAF_VERSION=${LEAF_VERSION} docker buildx bake -f docker-bake.hcl -f docker-bake-leaf-version-override.json leaf-version-update-helper --set "drupal.tags=${FROM}" | ||
id=$(docker create "${FROM}") | ||
docker cp $id:/tmp/docker-bake-leaf-version-override.json . | ||
docker rm -v $id | ||
|
||
# update Drupal core.extension.yml | ||
wget --output-document docker/drupal/rootfs/var/www/drupal/config/sync/core.extension.yml https://gitlab.com/calincs/cwrc/leaf/leaf-base-i8/-/raw/${LEAF_VERSION}/docker/drupal/rootfs/var/www/drupal/config/sync/core.extension.yml | ||
|
||
export FROM=ghcr.io/cwrc/drupal-core-extension-helper:local | ||
docker buildx bake drupal-core-extension-helper --set "drupal.tags=${FROM}" | ||
id=$(docker create "${FROM}") | ||
docker cp $id:/tmp/core.extension.yml docker/drupal/rootfs/var/www/drupal/config/sync/core.extension.yml | ||
docker rm -v $id | ||
|
||
# Update Drupal composer.json and composer.lock | ||
wget --output-document docker/drupal/rootfs/var/www/drupal/composer.json https://gitlab.com/calincs/cwrc/leaf/leaf-base-i8/-/raw/${LEAF_VERSION}/docker/drupal/rootfs/var/www/drupal/composer.json | ||
wget --output-document docker/drupal/rootfs/var/www/drupal/composer.lock https://gitlab.com/calincs/cwrc/leaf/leaf-base-i8/-/raw/${LEAF_VERSION}/docker/drupal/rootfs/var/www/drupal/composer.lock | ||
|
||
docker buildx bake -f docker-bake.hcl -f docker-bake-leaf-version-override.json drupal-composer-helper --set "drupal.tags=ghcr.io/cwrc/drupal:local" | ||
id=$(docker create "ghcr.io/cwrc/drupal:local") | ||
docker cp $id:/var/www/drupal/composer.json docker/drupal/rootfs/var/www/drupal/ | ||
docker cp $id:/var/www/drupal/composer.lock docker/drupal/rootfs/var/www/drupal/ | ||
docker rm -v $id |
3 changes: 3 additions & 0 deletions
3
docker/drupal/scripts/core.extension_cwrc_customizations_template.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module: | ||
getjwtonlogin: 0 | ||
islandora_bagger_integration: 0 |
Oops, something went wrong.