-
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.
- Loading branch information
Showing
5 changed files
with
133 additions
and
61 deletions.
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,26 @@ | ||
# Jetty WordPress Image | ||
> This image is based off the official Docker image maintained by the Docker community: https://hub.docker.com/_/wordpress | ||
## Adding New Image Versions | ||
The `versions.yml` contains the config for the image versions supported. When adding new versions, please check the tags supported by the WordPress image: https://hub.docker.com/_/wordpress/tags. | ||
|
||
Example `versions.yml`: | ||
```yml | ||
6.0: [8.1, 8,0] | ||
``` | ||
This will generate the `config.json` for the CircleCI `bigbite/docker-image-extend` orb, containing WordPress 6.0, with PHP versions 8.1 and 8.0: | ||
|
||
Example generated `conifg.json`: | ||
```json | ||
[ | ||
{ "tag": "6.0-php8.1", "args": { "WORDPRESS_IMAGE": "6.0-php8.1" } }, | ||
{ "tag": "6.0-php8.0", "args": { "WORDPRESS_IMAGE": "6.0-php8.0" } }, | ||
] | ||
``` | ||
|
||
To generate the `config.json` file, run: | ||
|
||
``` | ||
./generate-config.sh versions.yml > config.json | ||
``` |
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 |
---|---|---|
@@ -1,58 +1,11 @@ | ||
[ | ||
{ | ||
"tag": "6.0-php8.1", | ||
"args": { | ||
"WORDPRESS_IMAGE": "6.0-php8.1" | ||
} | ||
}, | ||
{ | ||
"tag": "6.0-php8.0", | ||
"args": { | ||
"WORDPRESS_IMAGE": "6.0-php8.0" | ||
} | ||
}, | ||
{ | ||
"tag": "6.0-php7.4", | ||
"args": { | ||
"WORDPRESS_IMAGE": "6.0-php7.4" | ||
} | ||
}, | ||
|
||
{ | ||
"tag": "5.9-php8.1", | ||
"args": { | ||
"WORDPRESS_IMAGE": "5.9-php8.1" | ||
} | ||
}, | ||
{ | ||
"tag": "5.9-php8.0", | ||
"args": { | ||
"WORDPRESS_IMAGE": "5.9-php8.0" | ||
} | ||
}, | ||
{ | ||
"tag": "5.9-php7.4", | ||
"args": { | ||
"WORDPRESS_IMAGE": "5.9-php7.4" | ||
} | ||
}, | ||
|
||
{ | ||
"tag": "5.8-php8.1", | ||
"args": { | ||
"WORDPRESS_IMAGE": "5.8-php8.1" | ||
} | ||
}, | ||
{ | ||
"tag": "5.8-php8.0", | ||
"args": { | ||
"WORDPRESS_IMAGE": "5.8-php8.0" | ||
} | ||
}, | ||
{ | ||
"tag": "5.8-php7.4", | ||
"args": { | ||
"WORDPRESS_IMAGE": "5.8-php7.4" | ||
} | ||
} | ||
{ "tag": "6.1-php8.1", "args": { "WORDPRESS_IMAGE": "6.1-php8.1" } }, | ||
{ "tag": "6.1-php8.0", "args": { "WORDPRESS_IMAGE": "6.1-php8.0" } }, | ||
{ "tag": "6.1-php7.4", "args": { "WORDPRESS_IMAGE": "6.1-php7.4" } }, | ||
{ "tag": "6.0-php8.1", "args": { "WORDPRESS_IMAGE": "6.0-php8.1" } }, | ||
{ "tag": "6.0-php8.0", "args": { "WORDPRESS_IMAGE": "6.0-php8.0" } }, | ||
{ "tag": "6.0-php7.4", "args": { "WORDPRESS_IMAGE": "6.0-php7.4" } }, | ||
{ "tag": "5.9-php8.1", "args": { "WORDPRESS_IMAGE": "5.9-php8.1" } }, | ||
{ "tag": "5.9-php8.0", "args": { "WORDPRESS_IMAGE": "5.9-php8.0" } }, | ||
{ "tag": "5.9-php7.4", "args": { "WORDPRESS_IMAGE": "5.9-php7.4" } } | ||
] |
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,83 @@ | ||
#!/usr/bin/env bash | ||
|
||
# if no file supplied, exit | ||
if [[ ! -f "$1" ]]; then | ||
>&2 echo "File does not exist, or was not specified."; | ||
exit 1; | ||
fi | ||
|
||
# check whether verbose output is enabled | ||
declare -a positional_args; | ||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
--verbose|-v) | ||
verbose=1; | ||
shift; | ||
;; | ||
--*|-*) | ||
>&2 echo "Unknown option $1"; | ||
exit 1; | ||
;; | ||
*) | ||
positional_args+=("$1"); | ||
shift; | ||
;; | ||
esac | ||
done | ||
set -- "${positional_args[@]}"; | ||
|
||
# output verbose messages | ||
function verbose() { | ||
if [ $verbose ]; then | ||
>&2 echo "$1"; | ||
fi | ||
} | ||
|
||
# create an array to store our list of image strings | ||
declare -a images; | ||
|
||
# read file one line at a time. | ||
# each line contains the following: | ||
# wp.version: [php.version1,php.version2 ...] | ||
while IFS= read -r line; do | ||
verbose 'Reading line:'; | ||
verbose "- $line"; | ||
|
||
# line is keyed by wp version, so everything before the first semicolon is the wp version. | ||
wpVersion=$(echo "$line" | awk -F':' '{print $1}'); | ||
verbose "- - WP Version: $wpVersion"; | ||
|
||
# value for each line is an array of php versions, so everything after the semicolon is the array | ||
# use sed to strip anything that isn't a number, comma, or period, which leaves a csv of php versions | ||
phpVersions=$(echo "$line" | awk -F':' '{print $2}' | sed 's/[^0-9.,]//g'); | ||
verbose "- - PHP Versions: $phpVersions"; | ||
|
||
# split the php versions into an array by "exploding" on the comma | ||
IFS=',' read -r -a phpVersions <<< "$phpVersions" | ||
|
||
# for each version in the array | ||
for php in "${phpVersions[@]}"; do | ||
verbose "- - - Using PHP Version: $php"; | ||
|
||
# build the image name | ||
image=$(printf '%s-php%s' "$wpVersion" "$php"); | ||
verbose "- - - Image Name: $image"; | ||
|
||
# build the json entry for the image name, and add to an array of images | ||
images+=("$(printf '{ "tag": "%s", "args": { "WORDPRESS_IMAGE": "%s" } }' "$image" "$image")"); | ||
verbose "- - Generated JSON Entry: $(printf '{ "tag": "%s", "args": { "WORDPRESS_IMAGE": "%s" } }' "$image" "$image")"; | ||
done; | ||
done < "$1"; | ||
|
||
# start building the json! | ||
verbose 'Building JSON'; | ||
json=''; | ||
|
||
# for each found image | ||
for ((i = 0; i < "${#images[@]}"; i++)); do | ||
# add to the json string | ||
json=$(printf "%s,\n %s" "$json" "${images[$i]}"); | ||
done | ||
|
||
# wrap the string in an array to make it valid (lose the leading delims.) | ||
printf "[\n%s\n]" "${json:2}" |
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,4 @@ | ||
6.1: [ 8.1, 8.0, 7.4 ] | ||
6.0: [ 8.1, 8.0, 7.4 ] | ||
5.9: [ 8.1, 8.0, 7.4 ] | ||
5.8: [ 8.1, 8.0, 7.4 ] |