Commit Graph

136 Commits

Author SHA1 Message Date
David Zuelke 00a5fc7f0b call out subprocess termination from signals
when hitting Ctrl+C in a 'docker run bob …', the main script itself actually can't be terminated by Ctrl+C, because it's PID 1

in that case, rather than just shutting down silently (by terminating itself using a SIGINT), we will see the subprocess exit (because Ctrl+C is sent to the whole process group)

When this happens, the return code of the process will be negative, to indicate that it didn't exit with that code, but instead got terminated by a signal of that (absolute) number
2020-01-15 16:53:35 +01:00
David Zuelke 73822ec2f9 0.0.18 2020-01-15 02:01:38 +01:00
David Zuelke f8b002de47 Correctly handle Ctrl+C
When receiving a signal, a process must kill itself using the same signal
sys.exit()ing 0, 1, 130, whatever will not signal to the calling program that we terminated in response to the signal

Best example: `for f in a b c; do bob deploy $f; done`, hitting Ctrl+C should interrupt Bob and stop the bash loop, but does not with `sys.exit()`:

    # for x in php-7.3.13 php-7.3.13 php-7.3.13; do bob build $x; done
    Fetching dependencies... found 1:
      - libraries/libc-client-2007f

    Building formula php-7.3.13 in /tmp/bob-35s7cr5z:

    -----> Building php-7.3.13...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 18.7M  100 18.7M    0     0  7435k      0  0:00:02  0:00:02 --:--:-- 7434k
    ^Cool.
    Fetching dependencies... found 1:
      - libraries/libc-client-2007f

    Building formula php-7.3.13 in /tmp/bob-vmuko2ra:

    -----> Building php-7.3.13...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
     20 18.7M   20 3887k    0     0  7479k      0  0:00:02 --:--:--  0:00:02 7476k^Cool.
    Fetching dependencies... found 1:
      - libraries/libc-client-2007f

    Building formula php-7.3.13 in /tmp/bob-p2t8as81:

    -----> Building php-7.3.13...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      4 18.7M    4  943k    0     0  3599k      0  0:00:05 --:--:--  0:00:05 3588k^Cool.

We want instead to have the loop end upon the first Ctrl+C.

That's only possible if Bash knows that we exited in response to Ctrl+C (=SIGINT), then it'll also terminate the loop
Bash will report the exit status as 128+$signal, so 130 for SIGINT, but sys.exit(130) does not to the same thing - the value of 130 is simply bash's representation
Killing ourselves with the signal number that we are aborting in response to does all this correctly, and bash will see the right WIFSIGNALED() status of our program, not WIFEXITED()
2020-01-15 02:01:38 +01:00
David Zuelke bda46256d9 print all informational output to stderr
all output from the formula build is on stdout already

this allows easy separating of the two into e.g. raw compile logs without bob's messages
2020-01-15 02:01:38 +01:00
David Zuelke 840c089864 Remove subprocess piping
This brings Python 3 compatibility

With this change, all output from the formula ends up on stdout, without any buffering, meaning e.g. progress bars (from curl for instance) also finally show up in real time, without line buffering like before
2020-01-14 23:15:11 +01:00
Casey 5f8cf4e2fd Merge pull request #46 from heroku-python/allow-no-override
update so override_path checks for None
v0.0.17
2019-04-03 11:36:11 -07:00
Casey Faist 9b2890fb1c make CLI override name optional 2019-04-03 11:06:13 -07:00
Casey Faist da2bff5894 update so override_path checks for None 2019-04-03 10:49:57 -07:00
Casey 0709cc09d3 Merge pull request #45 from heroku-python/bugfix-release
update version for new release
v0.0.16
2019-04-03 10:09:02 -07:00
Casey Faist 188928861c update version for new release 2019-04-03 10:08:03 -07:00
Casey d509d958ab Merge pull request #44 from sharanraj124/master
Fix override_path variable
2019-04-03 10:03:23 -07:00
Saranraj c6f983cccb Fix override_path variable. 2019-04-02 16:01:09 +05:30
Casey b1d1828a1c update setup.py version to cut new release (#41) v0.0.15 2019-03-25 18:10:16 -07:00
Casey f668ca9601 Merge pull request #37 from heroku-python/allow-names
add ability to name formulas separately
2019-03-25 18:07:43 -07:00
Casey Faist da95c3b081 add ability to override the s3 archive file names
if given (via --name) the override name is passed to the formula as
the second argument
2019-03-25 18:05:31 -07:00
Casey 075d65ca50 Merge pull request #43 from heroku-python/nochmodx
execute build formulae through shell
2019-03-25 17:49:39 -07:00
David Zuelke e4b0ce3b63 execute build formulae through shell
this prevents the need for chmod +x on formulae

fixes #35
2019-03-25 17:45:40 -07:00
David Zülke ca23526e42 Revert "execute build formulae through shell" (#42) 2019-03-25 17:44:48 -07:00
Casey 1873f7ae72 Merge pull request #40 from heroku-python/nochmodx
execute build formulae through shell
2019-03-25 16:27:17 -07:00
David Zuelke d943f5a789 execute build formulae through shell
this prevents the need for chmod +x on formulae

fixes #35
2019-03-25 16:12:17 -07:00
David Zülke 00863664ac allow wildcards in dependencies (#39)
Example:

That would fetch the latest S3_PREFIX/php-7.3.*.tar.gz as a dependency
2019-03-25 16:12:01 -07:00
Casey 0fc6774fe1 Merge pull request #36 from heroku-python/pypi-homepage
Update repo URL in setup.py
2018-11-07 12:00:56 -06:00
Casey Faist 9fd97abe5e update author to Heroku v0.0.14 2018-11-07 11:59:12 -06:00
David Zülke 19c144a785 Update repo URL in setup.py
So PyPI.org points to the right place. Bumped version too.
2018-11-07 18:57:03 +01:00
Ed Morley e30c2e53ef v0.0.13 v0.0.13 2017-05-30 23:38:16 +01:00
kennethreitz 3c4f7f0822 Merge pull request #33 from edmorley/flake8
Add a basic Travis configuration that runs flake8 and 'bob --help'
2017-05-30 18:24:37 -04:00
Ed Morley dea1b170a8 Allow Travis run to fail on Python 3
I'll file a separate issue for adding Python 3 support.
2017-05-30 23:10:07 +01:00
Ed Morley d28bafeba4 Add 'bob --help' to the Travis run
In lieu of having a test suite, this at least ensures the setup.py
`console_scripts` entry is configured correctly, and that basic
CLI and arg functionality works.
2017-05-30 23:02:03 +01:00
Ed Morley 0373ef2b98 Run flake8 on Travis 2017-05-30 22:49:39 +01:00
Ed Morley e838ff0027 flake8 import and whitespace fixes 2017-05-30 22:48:21 +01:00
kennethreitz ace8d61313 Update README.md 2017-05-26 11:49:06 -04:00
kennethreitz 14d968045d Update README.md 2017-05-26 11:48:50 -04:00
kennethreitz 54211376a8 Merge pull request #32 from edmorley/clearer-tmpfile-names
Use clearer file and directory names for build output
2017-05-25 07:28:47 -07:00
kennethreitz 04cc84cccd Merge pull request #28 from edmorley/aws-auth-improvements
Improve UX when AWS credentials are not found or are for another account
2017-05-25 07:28:17 -07:00
Ed Morley 17e68dfd69 Print build directory & upload URL during build/deploy
Previously only the temporary build directory was output, not the
final build output location.

The upload URL is generated using:
http://boto.cloudhackers.com/en/latest/ref/s3.html#boto.s3.key.Key.generate_url

Fixes #10.
2017-05-25 14:03:34 +01:00
Ed Morley 480ba2ecab Fail gracefully if S3_BUCKET is not set
Previously this raised with the unclear:
`TypeError: cannot concatenate 'str' and 'NoneType' objects`
2017-05-25 01:51:16 +01:00
Ed Morley bce1e3509d Make errors output to stderr
Using `print_function` is the cleanest option out of those on:
https://stackoverflow.com/questions/5574702/how-to-print-to-stderr-in-python
2017-05-25 01:51:07 +01:00
Ed Morley 9df32fadee Use clearer file and directory names for build output
This makes it easier to differentiate between the archives for
dependencies and that of the final build output by bob when sifting
through `/tmp/`. The archive type is now also apparent when reading
the console output.

Before:
```
Building formula foo in /tmp/bobrmyuSG:
    ...
Archiving.
/tmp/tmp4JUwdj
Deploying.
...
```

After (when combined with #28):
```
Building formula foo in /tmp/bob-rmyuSG:
    ...
Archiving.
Created: /tmp/bob-build-tmp4JUwdj.tar.gz
Deploying.
...
```
2017-05-24 19:52:00 +01:00
Ed Morley 3f5018c69c Defer S3 connections until Formula instantiation
This prevents unnecessary connections to S3 or resultant error
messages when running `bob --help`.

Fixes #27.
2017-05-24 18:22:17 +01:00
Ed Morley 3cd9532ad2 Support no AWS credentials being found in the environment
This allows the build command to be used with public buckets even
if the user doesn't have their own AWS credentials.

Fixes #26.
2017-05-24 18:22:12 +01:00
Ed Morley 13f3689087 Move S3 connection handling to its own class
This means that the main bucket also benefits from the access denied
`anon=True` fall-back previously only used for the upstream bucket.
This helps with the case where AWS credentials are found, but are
for an account unrelated to either bucket.

Since the main bucket can now fall back to anonymous mode, a check
has been added to the deploy command to improve the UX.

Fixes:
https://github.com/kennethreitz/bob-builder/issues/26#issuecomment-301058112
2017-05-24 18:19:54 +01:00
kennethreitz 6360194c2b Merge pull request #29 from edmorley/unused-deps-imports
Remove unused dependencies and imports
2017-05-12 10:56:54 -04:00
kennethreitz 84030c8518 Merge pull request #30 from edmorley/add-gitignore
Add .gitignore
2017-05-12 10:56:25 -04:00
Ed Morley 6e15af87e0 Add .gitignore
This covers files generated by `pip install -e .` and
`./setup.py sdist bdist_wheel`.
2017-05-12 14:59:33 +01:00
Ed Morley 7053c3e708 Remove unused dependencies and imports 2017-05-12 14:52:32 +01:00
David Zuelke 506a972125 v0.0.12 v0.0.12 2016-12-22 17:19:59 +01:00
David Zülke 5ce25e7b9b Allow fallback to anon UPSTREAM_S3_BUCKET access (#24)
An UPSTREAM_S3_BUCKET should usually allow "Everyone" for listing bucket contents.
If the S3 credentials for the normal bucket do not explicitly have access, a 403 will occur.
In that case, we re-try fetching the upstream bucket with anonymous authentication.
2016-12-22 17:13:58 +01:00
kennethreitz f8c539ebf6 Merge pull request #25 from stof/patch-1
Update the repository URL
2016-07-20 12:59:02 -04:00
Christophe Coevoet 71d8824720 Update the repository URL 2016-07-20 17:04:14 +02:00
David Zuelke 130594f9c6 v0.0.11 v0.0.11 2016-07-05 14:54:11 +02:00