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: (different approach) makefile temp logic #1391

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mpryc
Copy link
Contributor

@mpryc mpryc commented May 2, 2024

This is PR similar to #1382, however reimplemented using shell script.

Note I am unable to create commits to 1382, that's why opening new PR so developers can comment which way to go.

Note This is not 100% finished, because it lacks the diff comparison compare part, but it can be easily added as part of the shell script and not Makefile if we agree on this implementation.

The logic is much simpler, because Makefile is not the right place to include functions from the scripts.

mateusoliveira43 and others added 2 commits April 17, 2024 11:28
Signed-off-by: Mateus Oliveira <[email protected]>
Introduction of the shell script that allows to run commands
inside 1-1 copy of the git oadp folder on the local system.

Signed-off-by: Michal Pryc <[email protected]>
Copy link

openshift-ci bot commented May 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mpryc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2024
# so we get the hash of the oadp-operator source code
pushd "$ABS_OADP_GIT_DIR"
CURRENT_GIT_HASH=$(git rev-parse HEAD)
COMMAND_TEMP_DIR=$(TMPDIR="${DEFAULT_TMP_DIR}" mktemp -d -t "${OADP_TMP_DIR_PREFIX}XXXX-${CURRENT_GIT_HASH}") || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

I think -t is deprecated by this command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would not worry about that. It's handy and works on MacOS as well. The deprecation help was way over 17 years ago, so I don't think it will be removed any time..

coreutils/coreutils@99b039f#diff-b034738a99620fcc3b4df8d87d50191f19cb37d848e9ee95e401fd32162b1921R93-R96

fi

# Propagate exit value if was provided
[ -n "${exit_val}" ] && echo "Exit code: ${exit_val}" && exit "$exit_val"
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to put curly braces around the third instance of exit_val? It looks like they were very carefully used on everything else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason, small mistake which does not have any implications. The exit_val=$1 makes it a single argument anyway so there is no difference between "$exit_val" and "${exit_val}"

@@ -0,0 +1,71 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Lev would like to know why you have a HACK in this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hack folder does already exists in the oadp-operator codebase:
https://github.com/openshift/oadp-operator/tree/master/hack

And it seems natural to put scripts within one folder that may have any name.

However in operator-sdk go-based operators it's a common to use hack/ folder for utility scripts as described in the:
https://sdk.operatorframework.io/docs/overview/project-layout/#golang

We use an absolute path of the place where the script resides, but we need to go one level up to be able to copy/rsync folder structure of the main oadp-operator, that is why we have on line number 4 comment about that.

Copy link
Contributor

Choose a reason for hiding this comment

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

@levhayutin FYI.. thank you @mpryc :)

Copy link
Contributor

@mateusoliveira43 mateusoliveira43 left a comment

Choose a reason for hiding this comment

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

I tried testing by running make api-isupdated and I think infinite loop happened. A part of the logs

filename overflows max-path len by 22: .makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe/.makefiletmpdir/oadp_tmp-SGu9-3f22ca6f887188a8df85df6971f29b845e6676fe

Fix quote around TMP_FOLDER_NAME that was passed to rsync and could
cause recurisve loop.

Also fix some errors reported by shellcheck.

Signed-off-by: Michal Pryc <[email protected]>
@mateusoliveira43 mateusoliveira43 self-requested a review May 21, 2024 13:59
Copy link

openshift-ci bot commented Jun 19, 2024

@mpryc: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.14-e2e-test-azure 3f22ca6 link true /test 4.14-e2e-test-azure
ci/prow/4.12-e2e-test-azure 3f22ca6 link true /test 4.12-e2e-test-azure
ci/prow/4.13-e2e-test-azure 3f22ca6 link true /test 4.13-e2e-test-azure
ci/prow/4.14-e2e-test-aws d44515f link true /test 4.14-e2e-test-aws
ci/prow/4.12-e2e-test-aws d44515f link true /test 4.12-e2e-test-aws
ci/prow/4.15-images d44515f link true /test 4.15-images
ci/prow/4.16-images d44515f link true /test 4.16-images
ci/prow/4.16-e2e-test-aws d44515f link true /test 4.16-e2e-test-aws
ci/prow/4.15-e2e-test-aws d44515f link true /test 4.15-e2e-test-aws
ci/prow/4.16-e2e-test-kubevirt-aws d44515f link true /test 4.16-e2e-test-kubevirt-aws
ci/prow/4.15-e2e-test-kubevirt-aws d44515f link true /test 4.15-e2e-test-kubevirt-aws
ci/prow/4.16-ci-index d44515f link true /test 4.16-ci-index
ci/prow/4.15-ci-index d44515f link true /test 4.15-ci-index

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 19, 2024
@openshift-merge-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

1 similar comment
@openshift-merge-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@mpryc
Copy link
Contributor Author

mpryc commented Jul 10, 2024

@mateusoliveira43 is this PR still something we want to address (I can work on rebase) or do we want to go in differeht path ?

@mateusoliveira43
Copy link
Contributor

yes, we need this to move forward with go mod tidy CI job

but I do not understand why we have a folder in gitignore if we are using temporary folders

@mpryc
Copy link
Contributor Author

mpryc commented Jul 10, 2024

yes, we need this to move forward with go mod tidy CI job

but I do not understand why we have a folder in gitignore if we are using temporary folders

In cases things goes wrong the temporary folder may be preserved for debug, and the last thing we want to do is to commit that:

https://github.com/openshift/oadp-operator/pull/1391/files#diff-8de5118a56011d553059dd47da58cea16ecd90598ef82d0d64bcba3ce9cc0423R11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants