-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for cross-repo triggers. (#22)
* add support for cross-repo triggers
- Loading branch information
Showing
12 changed files
with
620 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import logging | ||
import sys | ||
from dataclasses import dataclass | ||
|
||
import cliclasses | ||
import coloredlogs | ||
from cliclasses import Count | ||
|
||
from ci.util import pants | ||
|
||
|
||
@dataclass | ||
class Override: | ||
"""Overrides the Emote dependency in the requirements file""" | ||
|
||
"""The new commit to use""" | ||
commit: str | ||
|
||
"""The logging verbosity""" | ||
verbosity: Count = 0 | ||
|
||
|
||
args = cliclasses.parse_command_line(Override) | ||
coloredlogs.install(level=max((2 - args.verbosity), 0) * 10) | ||
|
||
logging.info("-- Updating requirements file") | ||
|
||
with open("requirements.txt") as f: | ||
lines = f.readlines() | ||
|
||
index = 0 | ||
for idx, line in enumerate(lines): | ||
if line.startswith("emote-rl"): | ||
index = idx | ||
break | ||
|
||
else: | ||
logging.error("Failed to locate package to override in requirements.txt") | ||
sys.exit(1) | ||
|
||
vcs_spec = f"git+https://github.com/EmbarkStudios/emote@{args.commit}#egg=emote-rl" | ||
new_line = f"emote-rl[atari,wandb,torch] @ {vcs_spec}" | ||
|
||
lines[index] = new_line | ||
|
||
logging.info("Setting line %s to '%s'", index, new_line) | ||
with open("requirements.txt", "w") as f: | ||
f.writelines(lines) | ||
|
||
|
||
logging.info("-- Generating lockfiles") | ||
info = pants("generate-lockfiles", "::") | ||
|
||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
set -euxo pipefail | ||
if [ "$#" -lt 1 ] ; then | ||
echo "usage: init.sh [yes|no]" | ||
exit 1 | ||
fi | ||
|
||
override_emote="$1" | ||
echo "--- Running init script: $override_emote" | ||
|
||
apt-get update && apt-get install -y swig | ||
bash get-pants.sh | ||
|
||
export PATH="/root/bin/:$PATH" | ||
|
||
if [[ "$override_emote" = "yes" && -v "EMOTE_COMMIT" ]]; then | ||
echo "-- Overriding emote" | ||
PANTS_CONCURRENT=true pants run ci/emote-override.py -- -v "$EMOTE_COMMIT" | ||
fi | ||
|
||
echo "--- Running main build step" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.