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

pre-install: General fixes in pre-install scripts #351

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

GabyCT
Copy link
Contributor

@GabyCT GabyCT commented Feb 22, 2024

This PR adds general fixes in the pre-install scripts like removing tab spaces where they are not needed as well as improving the definition of the variables.

Copy link
Member

@portersrc portersrc left a comment

Choose a reason for hiding this comment

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

lgtm

}

function purge_previous_manifests() {
manifest=${1}

local manifest="${1}"
Copy link
Contributor

Choose a reason for hiding this comment

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

it's recommended to define and set local variables separately (otherwise return values might be ignored)

Copy link
Contributor

@ldoktor ldoktor left a comment

Choose a reason for hiding this comment

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

Thanks @GabyCT, this improves the situation somehow. There is still a room for improvement, though. If you had some time I'd recommended using shellcheck to check the files (not saying it must pass with not failures, but it should help identifying the most obvious ones).

Still as I mentioned, it's definitely better than before so it can be merged as is and perhaps in the future someone can continue.

PS: I'm a big fan of yours style fixes, thank you for them :-)

@GabyCT GabyCT force-pushed the topic/fixpreinstall branch 3 times, most recently from f0005ff to 1179575 Compare February 28, 2024 15:53
@GabyCT
Copy link
Contributor Author

GabyCT commented Feb 28, 2024

Thanks @GabyCT, this improves the situation somehow. There is still a room for improvement, though. If you had some time I'd recommended using shellcheck to check the files (not saying it must pass with not failures, but it should help identifying the most obvious ones).

Still as I mentioned, it's definitely better than before so it can be merged as is and perhaps in the future someone can continue.

PS: I'm a big fan of yours style fixes, thank you for them :-)

@ldoktor thanks for all the feedback, I just use it the shellchek tool thanks

@@ -77,21 +78,21 @@ function build_payload() {
docker push "${registry}:${kernel_arch}-${tag}"
done

purge_previous_manifests ${registry}:${tag}
purge_previous_manifests ${registry}:latest
purge_previous_manifests "${registry}":"${tag}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be perhaps more human-readable to use a single quotation for the whole string purge_previous_manifests "${registry}:${tag}" (everywhere where it applies)

Copy link
Contributor

@ldoktor ldoktor left a comment

Choose a reason for hiding this comment

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

Thank you, @GabyCT, looks much better now. There is one style pattern I don't really like where you quote individual variables rather than single item/strings. Obviously when we want them to be separated it needs to be separated (which is a case in many of the new additions) but there are many places where only variables are quoted and the rest of the same string (meaning what gets passed as an individual item) is not quoted. This works well for the machine but is not that easy to follow for humans. Could you please "merge" those? (similarly even single variable patterns followed by string is better to be quoted as an item rather than separating: "${registry}":latest looks odd to me, "${registry}:latest" seems better).

Still it's just my observation, so take it for consideration and if you and others like this better, I will get used to this :-)

@GabyCT GabyCT force-pushed the topic/fixpreinstall branch 2 times, most recently from 0753861 to 45ee8c5 Compare February 29, 2024 16:41
@GabyCT
Copy link
Contributor Author

GabyCT commented Feb 29, 2024

@ldoktor changes applied thanks

docker manifest create "${extra_docker_manifest_flags}" \
"${registry}:${tag}" \
--amend "${registry}":x86_64-"${tag}" \
--amend "${registry}":s390x-"${tag}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Lines 86+87 still need to be treated

docker manifest create "${extra_docker_manifest_flags}" \
"${registry}:latest" \
--amend "${registry}":x86_64-"${tag}" \
--amend "${registry}":s390x-"${tag}"
Copy link
Contributor

Choose a reason for hiding this comment

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

those as well (91+92)

install -D -m 755 ${artifacts_dir}/opt/confidential-containers/bin/${flavour}-containerd /opt/confidential-containers/bin/containerd
install -D -m 644 ${artifacts_dir}/etc/systemd/system/containerd.service.d/containerd-for-cc-override.conf /etc/systemd/system/containerd.service.d/containerd-for-cc-override.conf
install -D -m 755 "${artifacts_dir}"/opt/confidential-containers/bin/"${flavour}"-containerd /opt/confidential-containers/bin/containerd
install -D -m 644 "${artifacts_dir}"/etc/systemd/system/containerd.service.d/containerd-for-cc-override.conf /etc/systemd/system/containerd.service.d/containerd-for-cc-override.conf
Copy link
Contributor

Choose a reason for hiding this comment

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

Those 2 lines as well

install -D -m 755 ${artifacts_dir}/opt/confidential-containers/bin/containerd-nydus-grpc /opt/confidential-containers/bin/containerd-nydus-grpc
install -D -m 755 ${artifacts_dir}/opt/confidential-containers/bin/nydus-overlayfs /opt/confidential-containers/bin/nydus-overlayfs
install -D -m 755 "${artifacts_dir}"/opt/confidential-containers/bin/containerd-nydus-grpc /opt/confidential-containers/bin/containerd-nydus-grpc
install -D -m 755 "${artifacts_dir}"/opt/confidential-containers/bin/nydus-overlayfs /opt/confidential-containers/bin/nydus-overlayfs
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here, it's a single argument to install so IMO it'd look better to quote it as a whole rather than an individual portion.

install -D -m 644 ${artifacts_dir}/opt/confidential-containers/share/nydus-snapshotter/config-coco-guest-pulling.toml /opt/confidential-containers/share/nydus-snapshotter/config-coco-guest-pulling.toml
install -D -m 644 ${artifacts_dir}/etc/systemd/system/nydus-snapshotter.service /etc/systemd/system/nydus-snapshotter.service
install -D -m 644 "${artifacts_dir}"/opt/confidential-containers/share/nydus-snapshotter/config-coco-guest-pulling.toml /opt/confidential-containers/share/nydus-snapshotter/config-coco-guest-pulling.toml
install -D -m 644 "${artifacts_dir}"/etc/systemd/system/nydus-snapshotter.service /etc/systemd/system/nydus-snapshotter.service
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here

if [ -d /etc/systemd/system/${container_engine}.service.d ]; then
rmdir --ignore-fail-on-non-empty /etc/systemd/system/${container_engine}.service.d
if [ -d /etc/systemd/system/"${container_engine}".service.d ]; then
rmdir --ignore-fail-on-non-empty /etc/systemd/system/"${container_engine}".service.d
Copy link
Contributor

Choose a reason for hiding this comment

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

here as well (110, 112, 113)

Copy link
Contributor

@ldoktor ldoktor left a comment

Choose a reason for hiding this comment

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

Thanks, it's better but there are still few places where individual pieces of an "item" are quoted individually rather than as a whole. Could you please take care of them as well?

@GabyCT GabyCT force-pushed the topic/fixpreinstall branch from 45ee8c5 to 7d8a0fd Compare March 5, 2024 17:02
This PR adds general fixes in the pre-install scripts like removing
tab spaces where they are not needed as well as improving the definition
of the variables.

Signed-off-by: Gabriela Cervantes <[email protected]>
@GabyCT
Copy link
Contributor Author

GabyCT commented Mar 5, 2024

@ldoktor thanks for all the feedback, I really appreciate it changes applied

Copy link
Contributor

@ldoktor ldoktor left a comment

Choose a reason for hiding this comment

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

lgtm, thanks for bearing with my nitpicks :-)

Copy link
Member

@fidencio fidencio left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @GabyCT!

@fidencio fidencio merged commit ef55c2e into confidential-containers:main Apr 5, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants