Skip to content

Make the build step fail when the curl operation fails.#6961

Merged
TravisEz13 merged 1 commit intoPowerShell:masterfrom
adelton:pipefail
Jun 4, 2018
Merged

Make the build step fail when the curl operation fails.#6961
TravisEz13 merged 1 commit intoPowerShell:masterfrom
adelton:pipefail

Conversation

@adelton
Copy link
Copy Markdown
Contributor

@adelton adelton commented May 31, 2018

PR Summary

Without the pipefail, the build step always succeeds and the layer gets cached, resulting in confusion during the next step failing and subsequent rebuild attempt.

PR Checklist

@msftclas
Copy link
Copy Markdown

msftclas commented May 31, 2018

CLA assistant check
All CLA requirements met.

@adelton
Copy link
Copy Markdown
Contributor Author

adelton commented May 31, 2018

We could also just redirect to the target file even if I understand the desire to show its content in the build logs with tee.

Without the pipefail, the step always succeeds and the layer gets
cached, resulting in confusion during the next step failing and
subsequent rebuild attempt.
@TravisEz13 TravisEz13 merged commit ebc7cdf into PowerShell:master Jun 4, 2018
@TravisEz13
Copy link
Copy Markdown
Member

This did not work on either Ubuntu image. I've reverted the change in the new repo I mentioned on another thread so far only for the Ubuntu images.

@adelton
Copy link
Copy Markdown
Contributor Author

adelton commented Jun 8, 2018

Ah, on Ubuntu, /bin/sh is symlink to dash, not bash. Sorry about that.

@adelton adelton deleted the pipefail branch June 11, 2018 08:32
@TravisEz13
Copy link
Copy Markdown
Member

TravisEz13 commented Jun 11, 2018

@adelton you could change the shell in the docker file and resubmit the PR for the ubuntu images in the PowerShell-Docker repo. If not, could you at least file an issue?

@adelton
Copy link
Copy Markdown
Contributor Author

adelton commented Jun 12, 2018

Do you mean running it all with bash -c '...'? That seems like an overkill.

I wonder if showing the result after the curl instead piping to tee could work? Something like (untested)

RUN cd /etc/yum.repos.d && curl -o microsoft.repo https://packages.microsoft.com/config/rhel/7/prod.repo && cat microsoft.repo

@TravisEz13
Copy link
Copy Markdown
Member

TravisEz13 commented Jun 12, 2018

You wouldn't have to put it in front of every command. You can simply change the shell. See an example of how to change the shell to Windows PowerShell here:

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

@adelton
Copy link
Copy Markdown
Contributor Author

adelton commented Jun 13, 2018

I wouldn't want to mess up with Ubuntu's choice of shell. My attempting to change the Ubuntu Dockerfiles was a mistake which I'm sorry for.

@TravisEz13
Copy link
Copy Markdown
Member

no problem

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.

3 participants