Commit Graph

18 Commits (823adab6bdf482d47464c39f3acf4f5a5c0ffd51)

Author SHA1 Message Date
Alexander Schulze ead9b43bd5 [cipd] Run cipd_impl.ps1 in constrained language mode
The script downloads the current cipd version from [1], and exposes
functions, variables and aliases into the session (dot-sourcing). This
is unnecessary and prevents the system from running in
ConstrainedLanguage mode.

The change runs the powershell script in script scope only to support
the ConstrainedLanguage mode.

[1] https://chrome-infra-packages.appspot.com/client

Bug: 1442051
Change-Id: I249396714ab41b7f5a5edb96f3146904b4e876f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4507036
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Auto-Submit: Alexander Schulze <alexschulze@chromium.org>
Commit-Queue: Alexander Schulze <alexschulze@chromium.org>
2 years ago
Vadim Shtayura 939cac7adb [cipd] Suppress findstr stdout.
We only care about %ERRORLEVEL%.

R=bryner@google.com

Change-Id: Icb8770f5948f5744b451ff475d363e52858aa135
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4190130
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
2 years ago
Vadim Shtayura 4f3b322a39 [cipd] Add windows-arm64 support to CIPD client bootstrap.
This actually updates the CIPD client to a version that has
a windows-arm64 build, as well as modifies the bootstrap script
to support multiple possible Windows platforms (which is very
similar to what was done to support mac-arm64 on OSX).

By default windows-amd64 is still used everywhere, even on arm64 OS.
To opt-in into windows-arm64, create a file .cipd_client_platform
under depot_tools directory with a single line "windows-arm64".

The bootstrap script now recognizes this file (if it exists) and
rebootstraps the CIPD client if the platform changes. Since this
check needs to happen on every CIPD invocation, it is done in
the batch file, to avoid hitting relatively heavy Powershell on
the hot path.

Finally, do some minor style cleanup in the powershell script to
make it look more consistent.

CIPD client change log:
9cc9fd49..5252f4fc7/cipd

R=bryner@google.com

Change-Id: I4fe5c4ea5e0b5cbb43e7b8c4702dc9fb0627c056
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4153336
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
2 years ago
Samuel Attard 44b73307ee ensure depot_tools and cipd can bootstrap on all windows paths
On windows paths with spaces some cipd and depot_tools bootstrap commands were failing due to misquoting or syntax that didn't support such paths.  This ensures that a clean bootstrap on a path such as "C:/Foo Bar/depot_tools" works as expected.

Change-Id: Ib516d16ed7809635369399f3df0eff2269ff6e2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3834965
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Robert Iannucci bffd63b243 [cipd] Take cipd.ps1 out of %PATH%.
Having it in %PATH% means that powershell users will accidentally
run 'cipd.ps1' when they should be running 'cipd.bat'; This would
cause them to get requests for input parameters (like the backend URL)
which they have no idea how to supply.

R=agable@chromium.org, nodir@chromium.org, vadimsh@google.com

Bug: 1073529
Change-Id: I62a3bd9e00229a2047293dba1ba480d28f77bf63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2161645
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
5 years ago
Vadim Shtayura 95fb6dc810 [cipd] Check CIPD client hash during updates on Windows.
This is Windows counterpart to https://chromium-review.googlesource.com/1171957

Also cleanup code style in cipd.ps1 script. It appears the common convention
for global variables in PowerShell is $GlobalVar and for locals is $localVar.

R=nodir@chromium.org, iannucci@chromium.org
BUG=870166

Change-Id: Ib8ffbad85497db31f7f5d44fdca6ed843e56f220
Reviewed-on: https://chromium-review.googlesource.com/1175248
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
7 years ago
Vadim Shtayura 7e50ee376b [cipd] Try to bootstrap CIPD from scratch if selfupdate fails.
When updating the CIPD client to be identified by SHA256 hash, old clients (that
have no idea about SHA256) fail during 'selfupdate'.

We'll roll our SHA256 support in two stages:
  1. Deploy new client that understand SHA256 using its SHA1 name, so
     self-update from old clients works.
  2. Deploy same (or newer) client using its SHA256 name. This would work since
     the client doing the self-update already understands SHA256 at this point.

But we can't guarantee that ALL depot_tools deployments will update through
stages (1) and (2) sequentially. Some of them may skip (1) and end-up directly
in (2), failing on 'selfupdate'.

This CL makes sure they can recover from this state by rebootstraping the client
from scratch (this works with SHA256 hashes).

R=nodir@chromium.org, iannucci@chromium.org
BUG=821194

Change-Id: I27dece19e0305b5b2d6f8b0130631c1bf5f6499c
Reviewed-on: https://chromium-review.googlesource.com/1149454
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Anatoly Matyukhin dc2c0b97e2 [cipd] Do not rewrite ERRORLEVEL
cipd.bat is called from bootstrap/win/win_tools.bat. ERRORLEVEL in
win_tools.bat script should not mean return code of cipd.bat.

Bug: none
Change-Id: Ia425d5054fa9c1e1f84b4a10decc265669911646
Reviewed-on: https://chromium-review.googlesource.com/987954
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Daniel Jacques 9f9d82ac94 Revert "[cipd] Bump version, log at warning."
This reverts commit 18aa2d93ed.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [cipd] Bump version, log at warning.
> 
> Bump the CIPD client version to
> e2a98b41adb3403b5b7771c4101b42a55dc2dd9e. This version inculdes support
> for the "-log-level" flag.
> 
> Update CIPD bootstrap scripts and tool installation scripts to log at
> warning level, so that standard operation doesn't produce any logs.
> 
> BUG=chromium:748651
> TEST=canary
>   - Tested this CIPD version on canary waterfall successfully.
>   - Tested "gclient" bootstrap and "vpython" / "led" on Windows system,
>     no output and works.
>   - Tested "vpython" / "led" on OSX system, no output and works.
> 
> Change-Id: Iae316908283c43c504f293aafdf897df83dccf8d
> Reviewed-on: https://chromium-review.googlesource.com/588889
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Daniel Jacques <dnj@chromium.org>

TBR=iannucci@chromium.org,dnj@chromium.org

Change-Id: Ia611c1aeb204c609ff3469076b8256c54e702230
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:748651
Reviewed-on: https://chromium-review.googlesource.com/589527
Reviewed-by: Daniel Jacques <dnj@chromium.org>
Commit-Queue: Daniel Jacques <dnj@chromium.org>
8 years ago
Dan Jacques 18aa2d93ed [cipd] Bump version, log at warning.
Bump the CIPD client version to
e2a98b41adb3403b5b7771c4101b42a55dc2dd9e. This version inculdes support
for the "-log-level" flag.

Update CIPD bootstrap scripts and tool installation scripts to log at
warning level, so that standard operation doesn't produce any logs.

BUG=chromium:748651
TEST=canary
  - Tested this CIPD version on canary waterfall successfully.
  - Tested "gclient" bootstrap and "vpython" / "led" on Windows system,
    no output and works.
  - Tested "vpython" / "led" on OSX system, no output and works.

Change-Id: Iae316908283c43c504f293aafdf897df83dccf8d
Reviewed-on: https://chromium-review.googlesource.com/588889
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Daniel Jacques <dnj@chromium.org>
8 years ago
Dan Jacques 642dd84c89 [win/bootstrap] Use "for" instead of "set".
Using "set /p" to read a file fails when STDOUT is not connected.
Replace it with a method of reading using "for".

In the Python batch file, we eat up some of our sled buffer in order to
accommodate currently-running Python scripts. They should now resume
past the end of the file without issue. The sled was oversized, so this
shouldn't affect upgrade paths.

BUG=chromium:746602
TEST=local
  - On Windows machine, tested upgrade from pre-rework and current
    bootstraps. This code works on both, and no running Python
    processes were disrupted on exit, suggesting the sled change is
    sound.
R=iannucci@chromium.org, smut@chromium.org

Change-Id: Ica51999d672dd4e448fdad797bffc06ec9e9febf
Reviewed-on: https://chromium-review.googlesource.com/578725
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: smut <smut@google.com>
8 years ago
Dan Jacques 7466d1a9b7 [cipd] Run client in .bat to preserve STDIN.
Currently, the PowerShell execution does not allow STDIN to be
read by the CIPD client. Fix this by using PowerShell to acquire
the client, but batch to actually invoke the client. This removes
some indirection and allows STDIN to function as expected.

BUG=None
TEST=local
  - Ran w/ and w/out ".cipd_client.exe" locally, observed
    install and fallthrough.
  - Ran w/ an error code, observed exit code being preserved.
  - Ran "auth-login", was able to paste token.

Change-Id: I4efafa7dc80aa093de0fbf5dfd188c299fa104db
Reviewed-on: https://chromium-review.googlesource.com/563602
Commit-Queue: Daniel Jacques <dnj@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Tobias Hilbrich 29c2afdb30 Fix hanging powershell
Powershell can try to read additional commands from stdin. The `< nul` makes
sure it reads an EOF and properly returns.

The motivation for this change was a hanging WebRTC build job on an automated
build machine.

R=iannucci@chromium.org, vadimsh@chromium.org

Details:
https://stackoverflow.com/questions/2041799/powershell-script-gets-stuck-doesnt-exit-when-called-from-batch-file
Bug:
Change-Id: I51df3927644ca3a7e212089e0c414e2e8eb0c02a
Reviewed-on: https://chromium-review.googlesource.com/549317
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Robert Iannucci a297b40f8a [cipd.bat] Switch cipd.bat to use -Command.
-File something.ps1 args is SUPPOSED to pass args (i.e. the rest of the
command line) through to the script. It seems, however, that it's
actually parsing the rest of the command line and throws up its
hands at a parameter like '-'.

-Command, however, seems to work.

R=vadimsh@chromium.org

Bug:
Change-Id: I617bf43f5b27bd2d0246106ab10b28e0a2fdd901
Reviewed-on: https://chromium-review.googlesource.com/495566
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Robert Iannucci 5ededcb5f2 Clear Zone.Identifier to allow depot_tools.zip bootstrap
BUG=680274

Change-Id: I47fd8d7a5380aca49c873006c4f66732b21bee37
Reviewed-on: https://chromium-review.googlesource.com/427323
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
Vadim Shtayura d3cee645d7 Revert "Allow cipd.ps1 execution even if it was fetched from depot_tools.zip."
This reverts commit 15f122ee64.

Reason for revert: lots of bots are running Powershell 2. the 
new step fails on them (non-fatally though, just generating 
errors in the log, e.g. https://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/357219/steps/ensure%20git%20tooling%20on%20windows/logs/stdio)

Original change's description:
> Allow cipd.ps1 execution even if it was fetched from depot_tools.zip.
> 
> Windows keeps track of files downloaded from the Internet and powershell by
> default refuses to execute them (even with RemoteSigned policy). We need to
> explicitly unblock the file first.
> 
> Note: it requires Powershell >= 3.0.
> 
> R=dpranke@chromium.org, iannucci@chromium.org
> BUG=663843
> 
> Change-Id: Id681f4058f906fa4782a360be184d132d837ae78
> Reviewed-on: https://chromium-review.googlesource.com/424327
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
> 

TBR=iannucci@chromium.org,vadimsh@chromium.org,dpranke@chromium.org,chromium-reviews@chromium.org
BUG=663843
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Ibdc58e60d3f35a760de45bc1f71c88c1c4d2f2df
Reviewed-on: https://chromium-review.googlesource.com/424872
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
8 years ago
Vadim Shtayura 15f122ee64 Allow cipd.ps1 execution even if it was fetched from depot_tools.zip.
Windows keeps track of files downloaded from the Internet and powershell by
default refuses to execute them (even with RemoteSigned policy). We need to
explicitly unblock the file first.

Note: it requires Powershell >= 3.0.

R=dpranke@chromium.org, iannucci@chromium.org
BUG=663843

Change-Id: Id681f4058f906fa4782a360be184d132d837ae78
Reviewed-on: https://chromium-review.googlesource.com/424327
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
8 years ago
Robert Iannucci 2188fe944f Add cipd bootstrap scripts to depot_tools.
This takes advantage of powershell on windows for a cleanish duplicate of the
posix version.

R=dnj@chromium.org, vadimsh@chromium.org
BUG=663843

Change-Id: Ib23a044ff912e3239b58848a26143eb6575826d5
Reviewed-on: https://chromium-review.googlesource.com/414228
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
8 years ago