Skip to content

Commit

Permalink
Image for 6.1.0b1 (#151)
Browse files Browse the repository at this point in the history
I have created branch 6.1.x as simple copy of 6.0.1, and have now
created a branch to use 6.1.0b1, which I have just tagged and released
on dist.plone.org.

I might very well overlook stuff that needs to be done for a first
Docker release in the 6.1.x series.

Also, we may need to come up with a better way to show the table of
latest releases: when we do a 6.0.14 release, it would be tedious to
have to update both the 6.0.x and 6.1.x branches.
  • Loading branch information
fredvd authored Nov 3, 2024
2 parents 0ae1356 + d459d7b commit bd275d2
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Update Docker Hub Description
on:
push:
branches:
- '6.0.x'
- '6.1.x'
paths:
- "README.md"
- .github/workflows/description.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
env:
BASE_IMAGE_NAME: plone/server
PLATFORMS: linux/amd64,linux/arm64
IS_LATEST: true
IS_LATEST: false

jobs:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Test generated image
on:
push:
branches:
- "6.0.x"
- "6.1.x"
pull_request:
branches:
- "6.0.x"
- "6.1.x"

jobs:

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ These images are **not** Buildout based!
| Plone Version | Tags | Dockerfile |
| --- | --- | --- |
| 6 | `6.0.13`, `6.0`, `6`, `latest` | [(6.0.x/Dockerfile)](https://github.com/plone/plone-backend/blob/v6.0.13/Dockerfile)|
| 6.1 | `6.1.0b1`, `6.1` | [(6.1.x/Dockerfile)](https://github.com/plone/plone-backend/blob/v6.1.0b1/Dockerfile)|
| 6 (nightly) | `nightly` | [(Dockerfile.nightly)](https://github.com/plone/plone-backend/blob/6.0.x/Dockerfile.nightly) |

### Unsupported tags
Expand Down
133 changes: 82 additions & 51 deletions skeleton/scripts/create_site.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFPlone.factory import _DEFAULT_PROFILE
from Products.CMFPlone.factory import addPloneSite
from pathlib import Path
from plone.distribution.api import site as site_api
from Testing.makerequest import makerequest

import transaction
import json
import logging
import os
import transaction


logging.basicConfig(format="%(message)s")

# Silence some loggers
for logger_name in [
"GenericSetup.componentregistry",
"Products.MimetypesRegistry.MimeTypesRegistry",
]:
logging.getLogger(logger_name).setLevel(logging.ERROR)

logger = logging.getLogger("Plone Site Creation")
logger.setLevel(logging.DEBUG)

truthy = frozenset(('t', 'true', 'y', 'yes', 'on', '1'))
SCRIPT_DIR = Path().cwd() / "scripts"

truthy = frozenset(("t", "true", "y", "yes", "on", "1"))


def asbool(s):
Expand All @@ -22,7 +38,7 @@ def asbool(s):
return s.lower() in truthy


app = makerequest(app)
app = makerequest(globals()["app"])

request = app.REQUEST

Expand All @@ -31,56 +47,71 @@ def asbool(s):
newSecurityManager(None, admin)

# VARS
TYPE = os.getenv("TYPE", "volto")
SITE_ID = os.getenv("SITE_ID", "Plone")
SETUP_CONTENT = asbool(os.getenv("SETUP_CONTENT"))
ANSWERS = os.getenv("ANSWERS", "default")
DELETE_EXISTING = asbool(os.getenv("DELETE_EXISTING"))
LANGUAGE = os.getenv("LANGUAGE", "en")
TIMEZONE = os.getenv("TIMEZONE", "Europe/Berlin")
DISTRIBUTION = os.getenv("DISTRIBUTION", "")

if not DISTRIBUTION:
# We used to support setting TYPE 'volto' or 'classic'.
TYPE = os.getenv("TYPE", "")
if TYPE == "classic":
DISTRIBUTION = "classic"
elif TYPE == "volto":
DISTRIBUTION = "default"

# Load default site creation parameters
answers_file = SCRIPT_DIR / f"{ANSWERS}.json"
answers = json.loads(answers_file.read_text())

# Override the defaults from the OS environment
if DISTRIBUTION:
answers["distribution"] = DISTRIBUTION
SITE_ID = os.getenv("SITE_ID")
if SITE_ID:
answers["site_id"] = SITE_ID
LANGUAGE = os.getenv("LANGUAGE")
if LANGUAGE:
answers["default_language"] = LANGUAGE
SETUP_CONTENT = os.getenv("SETUP_CONTENT")
if SETUP_CONTENT is not None:
answers["setup_content"] = asbool(SETUP_CONTENT)
TIMEZONE = os.getenv("TIMEZONE")
if TIMEZONE:
answers["portal_timezone"] = TIMEZONE
ADDITIONAL_PROFILES = os.getenv("PROFILES", os.getenv("ADDITIONAL_PROFILES", ""))
additional_profiles = []
if ADDITIONAL_PROFILES:
additional_profiles = [profile.strip() for profile in ADDITIONAL_PROFILES.split(",")]

# Get the final site_id and distribution from the updated answers.
site_id = answers["site_id"]
DISTRIBUTION = answers["distribution"]
logger.info(f"Creating a new Plone site @ {site_id}")
logger.info(f" - Using the {DISTRIBUTION} distribution and answers from {answers_file}")

PROFILES = {
"volto": [
"plone.app.caching:default",
"plonetheme.barceloneta:default",
"plone.volto:default",
"plone.volto:default-homepage",
],
"classic": [
"plone.app.caching:default",
"plonetheme.barceloneta:default",
],
}


def profile_ids(site_type):
extension_ids = PROFILES[site_type]
if ADDITIONAL_PROFILES:
extension_ids.extend(
[
profile.strip()
for profile in ADDITIONAL_PROFILES.split(" ")
if profile.strip()
]
)
return extension_ids


payload = {
"title": "Plone",
"profile_id": _DEFAULT_PROFILE,
"extension_ids": profile_ids(TYPE),
"setup_content": SETUP_CONTENT,
"default_language": LANGUAGE,
"portal_timezone": TIMEZONE,
}

if SITE_ID in app.objectIds() and DELETE_EXISTING:
app.manage_delObjects([SITE_ID])

if site_id in app.objectIds() and DELETE_EXISTING:
app.manage_delObjects([site_id])
transaction.commit()
app._p_jar.sync()

if SITE_ID not in app.objectIds():
site = addPloneSite(app, SITE_ID, **payload)
logger.info(f" - Deleted existing site with id {site_id}")
else:
logger.info(
f" - Stopping site creation, as there is already a site with id {site_id}. "
"Set DELETE_EXISTING=1 to delete the existing site before creating a new one."
)

if site_id not in app.objectIds():
site = site_api._create_site(
context=app, distribution_name=DISTRIBUTION, answers=answers
)
transaction.commit()
app._p_jar.sync()
logger.info(" - Site created!")

if additional_profiles:
for profile_id in additional_profiles:
logger.info(f" - Importing profile {profile_id}")
site.portal_setup.runAllImportStepsFromProfile(f"profile-{profile_id}")
transaction.commit()
app._p_jar.sync()
8 changes: 8 additions & 0 deletions skeleton/scripts/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"site_id": "Plone",
"title": "Welcome to Plone 6",
"description": "Site created with a new Plone Distribution",
"default_language": "en",
"portal_timezone": "Europe/Berlin",
"setup_content": true
}
14 changes: 1 addition & 13 deletions test/tests/plone-arbitrary-user/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,7 @@ get() {
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}


. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"

# Plone is up and running
[[ "$(get 'http://plone:8080')" == *"Plone is up and running"* ]]

# Create a Plone site
[[ "$(get_auth 'http://plone:8080/@@plone-addsite' "$(echo -n 'admin:admin' | base64)")" == *"Create a Plone site"* ]]
[[ "$(get 'http://plone:8080')" == *"Welcome to Plone!"* ]]
14 changes: 1 addition & 13 deletions test/tests/plone-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,7 @@ get() {
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$cname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}


. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"

# Plone is up and running
[[ "$(get 'http://plone:8080')" == *"Plone is up and running"* ]]

# Create a Plone site
[[ "$(get_auth 'http://plone:8080/@@plone-addsite' "$(echo -n 'admin:admin' | base64)")" == *"Create a Plone site"* ]]
[[ "$(get 'http://plone:8080')" == *"Welcome to Plone!"* ]]
2 changes: 1 addition & 1 deletion test/tests/plone-listenport/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ get() {
. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8081"

# Plone is up and running
[[ "$(get 'http://plone:8081')" == *"Plone is up and running"* ]]
[[ "$(get 'http://plone:8081')" == *"Welcome to Plone!"* ]]
13 changes: 1 addition & 12 deletions test/tests/plone-relstorage/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ get() {
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$pname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}

. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"

# Plone is up and running
[[ "$(get 'http://plone:8080')" == *"Plone is up and running"* ]]

# Create a Plone site
[[ "$(get_auth 'http://plone:8080/@@plone-addsite' "$(echo -n 'admin:admin' | base64)")" == *"Create a Plone site"* ]]
[[ "$(get 'http://plone:8080')" == *"Welcome to Plone!"* ]]
13 changes: 1 addition & 12 deletions test/tests/plone-shared-blob-dir/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ get() {
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "${pname}":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}

. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"

# Plone is up and running
[[ "$(get 'http://plone:8080')" == *"Plone is up and running"* ]]

# Create a Plone site
[[ "$(get_auth 'http://plone:8080/@@plone-addsite' "$(echo -n 'admin:admin' | base64)")" == *"Create a Plone site"* ]]
[[ "$(get 'http://plone:8080')" == *"Welcome to Plone!"* ]]
13 changes: 1 addition & 12 deletions test/tests/plone-zeoclient/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,7 @@ get() {
-c "from urllib.request import urlopen; con = urlopen('$1'); print(con.read())"
}

get_auth() {
docker run --rm -i \
--link "$pname":plone \
--entrypoint /app/bin/python \
"$image" \
-c "from urllib.request import urlopen, Request; request = Request('$1'); request.add_header('Authorization', 'Basic $2'); print(urlopen(request).read())"
}

. "$dir/../../retry.sh" --tries "$PLONE_TEST_TRIES" --sleep "$PLONE_TEST_SLEEP" get "http://plone:8080"

# Plone is up and running
[[ "$(get 'http://plone:8080')" == *"Plone is up and running"* ]]

# Create a Plone site
[[ "$(get_auth 'http://plone:8080/@@plone-addsite' "$(echo -n 'admin:admin' | base64)")" == *"Create a Plone site"* ]]
[[ "$(get 'http://plone:8080')" == *"Welcome to Plone!"* ]]
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.13
6.1.0b1

0 comments on commit bd275d2

Please sign in to comment.