Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI v2 as default #420

Merged
merged 29 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a8ade5e
Moved tests around for defaults
toote Jan 8, 2024
66e4def
Default CLI to version 2
toote Jan 10, 2024
77870e6
Default buildkit to enabled
toote Jan 10, 2024
180c0d6
Updated tests
toote Jan 10, 2024
3d5d233
Add setup and teardown to v1 build tests
toote Jan 8, 2024
20151e4
Updated documentation
toote Jan 8, 2024
36c801c
Correct pipeline with corrected test paths
toote Jan 8, 2024
2a275f7
Corrected build and push tests
toote Jan 8, 2024
0f8efc1
Corrected run and push tests
toote Jan 10, 2024
49b1609
Correct CLI default wiht SSH option
toote Jan 8, 2024
fde3d8b
Fixed multiple-command tests indentation and generalization
toote Jan 8, 2024
f4187d4
Correct SSH test when cli is V2
toote Jan 10, 2024
4f39ab1
Correct separator logic
toote Jan 10, 2024
3543903
Corrected tests
toote Jan 10, 2024
ce0e6ee
Restructure all available options
toote Jan 10, 2024
b5060a9
Nested example titles
toote Jan 10, 2024
5833099
args is build only (removed tests in run that no longer make sense)
toote Jan 10, 2024
a30f370
reviewed and updated all options in docs and schema
toote Jan 10, 2024
1617e32
Moved all examples to their own folder
toote Jan 11, 2024
d6c448b
Corrected dependency syntax
toote Jan 11, 2024
19c0f7a
Have linter review examples on their own file
toote Jan 11, 2024
d82c6c3
Bumped version to next major one
toote Jan 11, 2024
9ced6e7
Added documentation about upgrading
toote Jan 11, 2024
c9f2ab2
Correct race condition with pipeline
toote Jan 11, 2024
7a2412d
Mergeback from 'toote_cache_from' to resolve conflicts
toote Feb 7, 2024
1678f88
Mergeback from 'toote_v2_default' to resolve conflicts
toote Feb 7, 2024
03cbb7c
Added types for non-string options
toote Feb 14, 2024
f1bd553
Added missing option to schema and sorted optional ones alphabetically
toote Feb 14, 2024
a309a4b
Merge pull request #421 from buildkite-plugins/toote_documentation_up…
tomowatt Feb 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ steps:
plugins:
${BUILDKITE_PULL_REQUEST_REPO:-$BUILDKITE_REPO}#${BUILDKITE_COMMIT}:
run: tests
command: ["bats", "tests", "tests/v2"]
# for pretty colors
tty: true
command: ["bats", "tests", "tests/v1"]

# The rest of the steps are integration tests

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,11 @@ The default is `on-error`.

### `cli-version` (optional, string or integer)

If set to `2`, plugin will use `docker compose` to execute commands; otherwise it will default to version `1`, using `docker-compose` instead.
If set to `1`, plugin will use `docker-compose` (that is deprecated and unsupported) to execute commands; otherwise it will default to version `2`, using `docker compose` instead.

### `buildkit` (optional, build only, boolean)

Assuming you have a compatible docker installation and configuration in the agent, activating this option would setup the environment for the `docker-compose build` call to use BuildKit. Note that if you are using `cli-version` 2, you are already using buildkit by default.
Assuming you have a compatible docker installation and configuration in the agent, activating this option would setup the environment for the `docker compose build` call to use BuildKit. Note that this should only be necessary if you are using `cli-version` 1 (version 2 already uses buildkit by default).

You may want to also add `BUILDKIT_INLINE_CACHE=1` to your build arguments (`args` option in this plugin), but know that [there are known issues with it](https://github.com/moby/buildkit/issues/2274).

Expand Down
4 changes: 2 additions & 2 deletions commands/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ else
group_type="+++"
fi

if [[ "$(plugin_read_config BUILDKIT "false")" == "true" ]]; then
if [[ "$(plugin_read_config BUILDKIT "true")" == "true" ]]; then
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
export BUILDKIT_PROGRESS=plain
Expand Down Expand Up @@ -95,7 +95,7 @@ while read -r line ; do
done <<< "$(plugin_read_list SECRETS)"

if [[ "$(plugin_read_config SSH "false")" != "false" ]] ; then
if [[ "${DOCKER_BUILDKIT:-}" != "1" && "${BUILDKITE_PLUGIN_DOCKER_COMPOSE_CLI_VERSION:-}" != "2" ]]; then
if [[ "${DOCKER_BUILDKIT:-}" != "1" && "${BUILDKITE_PLUGIN_DOCKER_COMPOSE_CLI_VERSION:-2}" != "2" ]]; then
echo "🚨 You can not use the ssh option if you are not using buildkit"
exit 1
fi
Expand Down
6 changes: 3 additions & 3 deletions lib/push.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ compose_image_for_service() {
default_compose_image_for_service() {
local service="$1"

local separator="_"
if [[ "$(plugin_read_config CLI_VERSION "1")" == "2" ]] && [[ "$(plugin_read_config COMPATIBILITY "false")" != "true" ]] ; then
separator="-"
local separator="-"
if [[ "$(plugin_read_config CLI_VERSION "2")" == "1" ]] || [[ "$(plugin_read_config COMPATIBILITY "false")" == "true" ]] ; then
separator="_"
fi

printf '%s%s%s\n' "$(docker_compose_project_name)" "$separator" "$service"
Expand Down
2 changes: 1 addition & 1 deletion lib/shared.bash
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function build_image_override_file_with_version() {
# Runs the docker-compose command, scoped to the project, with the given arguments
function run_docker_compose() {
local command=(docker-compose)
if [[ "$(plugin_read_config CLI_VERSION "1")" == "2" ]] ; then
if [[ "$(plugin_read_config CLI_VERSION "2")" == "2" ]] ; then
command=(docker compose)
fi

Expand Down
Loading