Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/BBVA/kapow
Browse files Browse the repository at this point in the history
  • Loading branch information
Héctor Hurtado committed Aug 17, 2020
2 parents dc2716f + 94f1e7e commit 6ce20f6
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 25 deletions.
1 change: 1 addition & 0 deletions .github/versions/go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.14.3
29 changes: 29 additions & 0 deletions .github/workflows/go-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Bump Go

on:
schedule:
- cron: 00 7 * * *

push:
branches:
- master

jobs:
go-bump:

runs-on: ubuntu-20.04

steps:
- name: Clone current repo
uses: actions/checkout@v2

- name: Bump Go
id: go-bump
uses: panchoh/go-bump@master

- name: Create pull request
uses: peter-evans/create-pull-request@v2
with:
title: ${{ steps.go-bump.outputs.pr-title }}
commit-message: ${{ steps.go-bump.outputs.pr-title }}
branch: ${{ steps.go-bump.outputs.branch-name }}
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
tags:
- v*.*.*

env:
GO_VERSION: 1.14.4

jobs:
build:

Expand All @@ -18,6 +15,11 @@ jobs:
with:
fetch-depth: 0

- name: Load Go version
id: go-version
run: |
echo "::set-env name=GO_VERSION::$(tr -d '\n' < .github/versions/go)"
- uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on:
push:

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.27

- name: Build
run: |
make test race build
- name: Spec test
run: |
docker run --mount type=bind,source=$(pwd)/build/kapow,target=/usr/local/bin/kapow bbvalabsci/kapow-spec-test-suite:latest behave --tags=~@skip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img alt="Kapow! Logo" src="https://raw.githubusercontent.com/BBVA/kapow/master/docs/source/_static/logo.png" width=300 />
<h3 align="center">If you can script it, you can HTTP it.</h3>
<p align="center">
<a href="https://circleci.com/gh/BBVA/kapow/tree/master"><img alt="Test status" src="https://circleci.com/gh/BBVA/kapow/tree/master.svg?style=svg" /></a>
<a href="https://github.com/BBVA/kapow/actions?query=workflow%3ATest"><img alt="Test status" src="https://github.com/BBVA/kapow/workflows/Test/badge.svg" /></a>
<a href="https://goreportcard.com/badge/github.com/bbva/kapow"><img alt="Go Report" src="https://goreportcard.com/badge/github.com/bbva/kapow" /></a>
<a href="https://github.com/BBVA/kapow/issues/"><img alt="Open Issues" src="https://img.shields.io/github/issues/BBVA/kapow" /></a>
<a href="https://kapow.readthedocs.io"><img alt="Documentation" src="https://img.shields.io/readthedocs/kapow" /></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/source/concepts/resource_tree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Overview
/
├─ request
│ ├──── method Used HTTP Method (GET, POST)
│ ├──── method HTTP Method used (GET, POST)
│ ├──── host Host part of the URL
│ ├──── path Complete URL path (URL-unquoted)
│ ├──── matches
Expand Down
19 changes: 7 additions & 12 deletions docs/source/examples/working_with_pow_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ whole thing documented in one html file, served with *Kapow!*.
:linenos:
$ cat index.pow
#!/usr/bin/env bash
kapow route add / - <<-'EOF'
cat howto.html | kapow set /response/body
EOF
Expand All @@ -99,22 +97,19 @@ source. In fact, a `pow` file is just a regular shell script.
Debugging scripts
-----------------

Kapow! redirect standard output and standard error of the pow file given on server
startup to its own standard output and error, so you can use ``set -x`` at the beginning
of the script in order to be able to see all the commands expanded and usethat information
for debugging.
Since *Kapow!* redirects the standard output and the standard error of the `pow`
file given on server startup to its own, you can leverage ``set -x`` to see the
commands that are being executed, and use that for debugging.

In order to be able to debug user request executions, the server subcommand has
a ``--debug`` option flag that redirects the script standard output and standard error
to Kapow! standard output, so you can use ``set -x`` at the beginning of the script
the same way as in pow files.
To support debugging user request executions, the server subcommand has a
``--debug`` option flag that prompts *Kapow!* to redirect both the script's
standard output and standard error to *Kapow!*'s standard output, so you can
leverage ``set -x`` the same way as with `pow` files.


.. code-block:: console
$ cat withdebug.pow
#!/usr/bin/env bash
kapow route add / - <<-'EOF'
set -x
echo "This will be seen in the log"
Expand Down
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Welcome to *Kapow!*
===================

.. image:: https://circleci.com/gh/BBVA/kapow/tree/master.svg?style=svg
:target: https://circleci.com/gh/BBVA/kapow/tree/master
.. image:: https://github.com/BBVA/kapow/workflows/Test/badge.svg
:target: https://github.com/BBVA/kapow/actions?query=workflow%3ATest
.. image:: https://goreportcard.com/badge/github.com/bbva/kapow
:target: https://goreportcard.com/report/github.com/bbva/kapow
.. image:: https://img.shields.io/github/issues/BBVA/kapow
Expand Down
7 changes: 3 additions & 4 deletions docs/source/tutorial/tutorial02.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ What have we done?

**Junior**

Got it! There're a
`lot of resources to work with </theory/resource_tree.rst>`_, I see that we
can write to the response. Do you think this will work for us?
Got it! There're a :ref:`lot of resources to work with <resource-tree>`.
I see that we can write to the response. Do you think this will work for us?

**Senior**

Expand All @@ -47,7 +46,7 @@ What have we done?
**Senior**

Looks good to me, clean and simple, and it is a very good idea to use ``GET``
here as it wont change anything in the server. Let's restart *Kapow!* and try it.
here as it won't change anything in the server. Let's restart *Kapow!* and try it.

**Junior**

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/tutorial04.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ I Need my Report!

**Junior**

And why *Susan* can't ``ssh`` into the server herself to see all of this?
And why can't *Susan* ``ssh`` into the server herself to see all of this?

**Senior**

Expand Down
2 changes: 1 addition & 1 deletion spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ following resource paths:
/ The root of the resource paths tree
├─ request All information related to the HTTP request. Read-Only
│ ├──── method Used HTTP Method (GET, POST)
│ ├──── method HTTP Method used (GET, POST)
│ ├──── host Host part of the URL
│ ├──── path Complete URL path (URL-unquoted)
│ ├──── matches Previously matched URL path parts
Expand Down

0 comments on commit 6ce20f6

Please sign in to comment.