Fix the downstream build and release process (#259)

* Issue #254: Fix 'unbound variable' error with empty array.

* Issue #254: Make downstream-release work completely.

* Make sed commands cross-platform.
This commit is contained in:
Jeff Geerling
2020-10-09 11:06:55 -05:00
committed by GitHub
parent cbd3a2554e
commit f01644a565
3 changed files with 25 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
# Also needs to be updated in galaxy.yml
VERSION = 1.0.0
VERSION = 1.1.0
TEST_ARGS ?= ""
PYTHON_VERSION ?= `python -c 'import platform; print("{0}.{1}".format(platform.python_version_tuple()[0], platform.python_version_tuple()[1]))'`

View File

@@ -151,7 +151,11 @@ There are also integration tests in the `molecule` directory which are meant to
Releases are automatically built and pushed to Ansible Galaxy for any new tag. Before tagging a release, make sure to do the following:
1. Update `galaxy.yml` and this README's `requirements.yml` example with the new `version` for the collection.
1. Update the version in the following places:
a. The `version` in `galaxy.yml`
b. This README's `requirements.yml` example
c. The `DOWNSTREAM_VERSION` in `utils/downstream.sh`
d. The `VERSION` in `Makefile`
1. Update the CHANGELOG:
1. Make sure you have [`antsibull-changelog`](https://pypi.org/project/antsibull-changelog/) installed.
1. Make sure there are fragments for all known changes in `changelogs/fragments`.
@@ -168,7 +172,7 @@ Until the contents of repository are moved into a new `kubernetes.core` reposito
To publish the `kubernetes.core` collection on Ansible Galaxy, do the following:
1. Run `make downstream-release`.
1. Run `make downstream-release` (on macOS, add `LC_ALL=C` before the command).
The process for uploading a supported release to Automation Hub is documented separately.

View File

@@ -9,7 +9,7 @@
# - All functions are prefixed with f_ so it's obvious where they come
# from when in use throughout the script
DOWNSTREAM_VERSION="1.0.0"
DOWNSTREAM_VERSION="1.1.0"
KEEP_DOWNSTREAM_TMPDIR="${KEEP_DOWNSTREAM_TMPDIR:-''}"
@@ -64,14 +64,15 @@ f_show_help()
f_text_sub()
{
# Switch FQCN and dependent components
sed -i "s/community-kubernetes/kubernetes-core/" "${_build_dir}/Makefile"
sed -i "s/community\/kubernetes/kubernetes\/core/" "${_build_dir}/Makefile"
sed -i "s/^VERSION\:/VERSION: ${DOWNSTREAM_VERSION}/" "${_build_dir}/Makefile"
sed -i "s/community.kubernetes/kubernetes.core/" "${_build_dir}/galaxy.yml"
sed -i "s/name\:.*$/name: core/" "${_build_dir}/galaxy.yml"
sed -i "s/namespace\:.*$/namespace: kubernetes/" "${_build_dir}/galaxy.yml"
sed -i "s/^version\:.*$/version: ${DOWNSTREAM_VERSION}/" "${_build_dir}/galaxy.yml"
find "${_build_dir}" -type f -exec sed -i "s/community\.kubernetes/kubernetes\.core/g" {} \;
sed -i.bak "s/community-kubernetes/kubernetes-core/" "${_build_dir}/Makefile"
sed -i.bak "s/community\/kubernetes/kubernetes\/core/" "${_build_dir}/Makefile"
sed -i.bak "s/^VERSION\:/VERSION: ${DOWNSTREAM_VERSION}/" "${_build_dir}/Makefile"
sed -i.bak "s/community.kubernetes/kubernetes.core/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/name\:.*$/name: core/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/namespace\:.*$/namespace: kubernetes/" "${_build_dir}/galaxy.yml"
sed -i.bak "s/^version\:.*$/version: ${DOWNSTREAM_VERSION}/" "${_build_dir}/galaxy.yml"
find "${_build_dir}" -type f -exec sed -i.bak "s/community\.kubernetes/kubernetes\.core/g" {} \;
find "${_build_dir}" -type f -name "*.bak" -delete
}
f_cleanup()
@@ -103,12 +104,14 @@ f_create_collection_dir_structure()
do
cp -r "./${d_name}" "${_build_dir}/${d_name}"
done
for exclude_file in "${_file_exclude[@]}";
do
if [[ -f "${_build_dir}/${exclude_file}" ]]; then
rm -f "${_build_dir}/${exclude_file}"
fi
done
if [ -n "${_file_exclude:-}" ]; then
for exclude_file in "${_file_exclude[@]}";
do
if [[ -f "${_build_dir}/${exclude_file}" ]]; then
rm -f "${_build_dir}/${exclude_file}"
fi
done
fi
}
f_copy_collection_to_working_dir()