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

Fix #1684 #2234

Merged
merged 4 commits into from
Jun 26, 2023
Merged

Fix #1684 #2234

merged 4 commits into from
Jun 26, 2023

Conversation

azaslavsky
Copy link
Contributor

Previous situation: we do most of our "check minimum requirements" work in the aptly named check-minimum-requirements.sh. This would be a natural home for the "check if docker even exists on this system" verification, but we actually run call into docker info to set some environment variables before this script gets run, in detect-platforms.sh. So I've adde the "does docker exist" check to that file, directly before we call docker info.

@@ -12,8 +12,14 @@ echo "${_group}Detecting Docker platform"
# linux/amd64 by default due to virtualization.
# See https://github.com/docker/cli/issues/3286 for the Docker bug.

export DOCKER_EXISTS=$(command -v docker)
export DOCKER_ARCH=$(docker info --format '{{.Architecture}}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have moved this line after the check to avoid a silent failure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, can you elaborate a bit more - which line number are you proposing to move the `export DOCKER_EXISTS..." line to? Or are you suggesting we move it to a different file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line DOCKER_ARCH will silently fail if docker does not exist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, forgot that command substitutions get executed at decl time 🤦. Fixed.

Comment on lines 15 to 22
export DOCKER_EXISTS=$(command -v docker)
export DOCKER_ARCH=$(docker info --format '{{.Architecture}}')

if ! "$DOCKER_EXISTS" &>/dev/null; then
echo "FAIL: Could not find a \`docker\` binary on this system. Are you sure it's installed?"
exit 1
fi

This comment was marked as resolved.

Copy link
Contributor

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@azaslavsky azaslavsky merged commit 80d4e67 into master Jun 26, 2023
8 checks passed
@azaslavsky azaslavsky deleted the azaslavsky/1684/fix-install-script branch June 26, 2023 18:29
@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants