Skip to content

Commit

Permalink
Revert "cmd-init: Support specifying a subdirectory"
Browse files Browse the repository at this point in the history
Remove support for subdirectory in cosa init given that:
- we currently don't use this feature,
- we chose another path for multiple version support in openshift/os as
  using subdirectories lead to a lot of additionnal complexity.

See: openshift/os#803

This reverts commit 4781e46.
  • Loading branch information
travier committed Jul 27, 2022
1 parent 6864566 commit 862453b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/cmd-init
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ TRANSIENT=0
print_help() {
cat 1>&2 <<'EOF'
Usage: coreos-assembler init --help
coreos-assembler init [--force] [--transient] [--branch BRANCH]
[--commit COMMIT] GITCONFIG [SUBDIR]
coreos-assembler init [--force] [--transient] [--branch BRANCH]
[--commit COMMIT] GITCONFIG
For example, you can use https://github.com/coreos/fedora-coreos-config
as GITCONFIG, or fork it. Another option useful for local development
(if you're running a shell inside this container) is to pass a file path
starting with `/` - a symlink to it will be created and then used directly.
You can specify a branch of a git repo with the `--branch` flag.
If specified, SUBDIR is a subdirectory of the git repository that should
contain manifest.yaml and image.yaml (or image.ks).
Use `--transient` for builds that will throw away all cached data on success/failure,
and should hence not invoke `fsync()` for example.
EOF
Expand Down Expand Up @@ -83,7 +80,7 @@ while true; do
done

# If user did not provide a repo then error out
if [ $# = 0 ]; then
if [ $# -ne 1 ]; then
print_help
fatal "ERROR: Missing GITCONFIG"
exit 1
Expand All @@ -96,7 +93,6 @@ if [ "$FORCE" != "1" ] && [ -n "$(ls ./)" ]; then
fi

source=$1; shift
subdir=${1:-}

preflight

Expand All @@ -112,7 +108,7 @@ mkdir -p src
(cd src
if ! test -e config; then
case "${source}" in
/*) ln -s "${source}/${subdir}" config;;
/*) ln -s "${source}" config;;
*) git clone ${BRANCH:+--branch=${BRANCH}} --depth=1 --shallow-submodules --recurse-submodules "${source}" config
# If a commit was specified then we'll fetch and reset
# the specified branch to that commit. This is useful when
Expand All @@ -124,10 +120,6 @@ mkdir -p src
git -C ./config fetch origin "$COMMIT"
git -C ./config reset --hard "$COMMIT"
fi
if [ -n "${subdir}" ]; then
mv config config-git
ln -sr config-git/"${subdir}" config
fi
(set +x; cd config && echo -n "Config commit: " && git describe --tags --always --abbrev=42)
;;
esac
Expand Down

0 comments on commit 862453b

Please sign in to comment.