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: Fix sd-local display bug #465

Merged
merged 3 commits into from
Nov 8, 2023

Conversation

yakanechi
Copy link
Contributor

Context

In sd-local, there was a bug that the sd-setup-launcher command and output was displayed in the job step as follows when using images such as centos7 with /bin/sh as bash.

The reason for this is that the echo ; at the end of the sd-setup-local command is a return condition, so the output of the command is left out and displayed in later job steps.

INFO   [0000] Prepare to start build...                    
INFO   [0012] Pulling docker image from centos:centos7...  
sd-setup-launcher: set -e && export PATH=${PATH}:/opt/sd:/usr/sd/bin:/usr/sd-static/bin && finish() { EXITCODE=$?; tmpfile=/tmp/env_tmp; exportfile=/tmp/env_export; export -p | grep -vi "PS1=" > $tmpfile && mv -f $tmpfile $exportfile; echo $SD_STEP_ID $EXITCODE; } && trap finish ABRT EXIT;
sd-setup-launcher: echo ;
case1: $ echo "Hello world"
case1: set -e && export PATH=${PATH}:/opt/sd:/usr/sd/bin:/usr/sd-static/bin && finish() { EXITCODE=$?; tmpfile=/tmp/<n && finish() { EXITCODE=$?; tmpfile=/tmp/env_tmp; exportfile=/tmp/env_export; export -p | grep -vi "PS1=" > $tmpfi</env_export; export -p | grep -vi "PS1=" > $tmpfile && mv -f $tmpfile $exportfile; echo $SD_STEP_ID $EXITCODE; } && trap finish ABRT EXIT;                                                          
case1: echo ;
case1: 
case1: Hello world
case1:

Objective

Prevent the sd-setup-launcher command and output from appearing in the job step by making the output of echo ; a Return condition.

References

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@yakanechi yakanechi closed this Nov 6, 2023
@yakanechi yakanechi reopened this Nov 6, 2023
@yakanechi
Copy link
Contributor Author

It succeeds locally but fails with a timeout here.

@yakanechi yakanechi closed this Nov 6, 2023
@yakanechi yakanechi reopened this Nov 6, 2023
@jithine
Copy link
Member

jithine commented Nov 6, 2023

@yakanechi can you try running your local test inside the same container SD build uses ? https://github.com/screwdriver-cd/launcher/blob/master/screwdriver.yaml#L7

Perhaps use sd-local itself here :)

@yakanechi
Copy link
Contributor Author

@jithine
Thanks for your comment, it helped me solve the problem.
In the test environment,set -e was failing because it was outputting# characters, so a newline was added to separate the output of echo ;.

Copy link
Contributor

@ibu1224 ibu1224 left a comment

Choose a reason for hiding this comment

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

👍

@tkyi tkyi merged commit e3d4ffb into screwdriver-cd:master Nov 8, 2023
1 check passed
@yakanechi yakanechi deleted the fix-display branch November 19, 2023 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants