Commit 959db26
feature: add filtering of instructions on the exec command (#210)
## Summary:
- Add a `--exclude/-e` and `--include/-i` flags on the exec command to filter instructions. The filters are being validated then forwarded to SCLE where the filtering is done: https://github.com/strateos/lab/pull/1527
- Minor: use email address to specify who sent the payload.
Require: https://github.com/strateos/lab/pull/1526 to be merged in lab as well
### Usage:
```
cat autoprotocol.json | \
transcriptic exec -a lab.core.strateos.com/haven/wctest -w wc4-mcx1 -e 1-9 -i 7 -e op:provision
```
This command will first filter out instruction from index 1 to 9 (`-e 1-9`) and the provisions (`-e op:provision`). Then add back the instruction at index 7 (`-i 7`).
The order of `-i/-e` don't matter, it is first removing all the `-e`, then adding back all the `-i`.
### Filters
Possible filter:
- single index: 123
- range: 123-456
- key:value in the instruction: `op:provision`, or `x_human!:false`. The ! means that if the key (x_human) is not in the instruction, then the filter matches. Otherwise, without the '!' a missing key means that there is no match.
Filter example:
- { "op": "seal", "x_human": false } and { "op": "seal" } match `x_human!:false`
- { "op": "seal" } does not match`x_human:true`, nor `x_human:false`
### Test plan
Add unit tests
#### Manual testing
```
internal_protocols/clients/sd2/current_protocols/growth_curve [master*]$ transcriptic preview GrowthCurve | \
transcriptic exec -a lab.core.strateos.com/haven/wctest -w wc4-mcx1 -e x_human:true
Sending request to http://13.52.223.111:9000/testRun
Success. View http://lab.core.strateos.com/haven/wctest/dashboard to see the scheduling outcome.
```
or
```
internal_protocols/clients/sd2/current_protocols/growth_curve [master*]$ transcriptic preview GrowthCurve | \
transcriptic exec -a lab.core.strateos.com/haven/wctest -w wc4-mcx1 -e op:provision
Sending request to http://13.52.223.111:9000/testRun
Success. View http://lab.core.strateos.com/haven/wctest/dashboard to see the scheduling outcome.
```1 parent 2450a0e commit 959db26
3 files changed
Lines changed: 123 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | | - | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
34 | 45 | | |
35 | 46 | | |
36 | 47 | | |
| |||
94 | 105 | | |
95 | 106 | | |
96 | 107 | | |
97 | | - | |
| 108 | + | |
98 | 109 | | |
99 | 110 | | |
100 | 111 | | |
| |||
160 | 171 | | |
161 | 172 | | |
162 | 173 | | |
163 | | - | |
| 174 | + | |
164 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
693 | 707 | | |
694 | 708 | | |
695 | 709 | | |
| |||
707 | 721 | | |
708 | 722 | | |
709 | 723 | | |
| 724 | + | |
710 | 725 | | |
| 726 | + | |
711 | 727 | | |
712 | 728 | | |
713 | 729 | | |
| |||
718 | 734 | | |
719 | 735 | | |
720 | 736 | | |
| 737 | + | |
| 738 | + | |
721 | 739 | | |
722 | 740 | | |
723 | 741 | | |
| |||
734 | 752 | | |
735 | 753 | | |
736 | 754 | | |
| 755 | + | |
| 756 | + | |
737 | 757 | | |
738 | 758 | | |
739 | 759 | | |
| 760 | + | |
740 | 761 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1474 | 1474 | | |
1475 | 1475 | | |
1476 | 1476 | | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
1477 | 1499 | | |
1478 | 1500 | | |
1479 | 1501 | | |
| |||
1485 | 1507 | | |
1486 | 1508 | | |
1487 | 1509 | | |
| 1510 | + | |
| 1511 | + | |
1488 | 1512 | | |
1489 | 1513 | | |
1490 | 1514 | | |
| 1515 | + | |
1491 | 1516 | | |
1492 | 1517 | | |
1493 | 1518 | | |
| |||
1508 | 1533 | | |
1509 | 1534 | | |
1510 | 1535 | | |
1511 | | - | |
| 1536 | + | |
1512 | 1537 | | |
1513 | 1538 | | |
1514 | 1539 | | |
| |||
1518 | 1543 | | |
1519 | 1544 | | |
1520 | 1545 | | |
1521 | | - | |
1522 | 1546 | | |
1523 | | - | |
| 1547 | + | |
| 1548 | + | |
1524 | 1549 | | |
1525 | 1550 | | |
1526 | | - | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
1527 | 1567 | | |
1528 | 1568 | | |
1529 | 1569 | | |
| |||
1534 | 1574 | | |
1535 | 1575 | | |
1536 | 1576 | | |
1537 | | - | |
| 1577 | + | |
1538 | 1578 | | |
1539 | 1579 | | |
1540 | 1580 | | |
| |||
1549 | 1589 | | |
1550 | 1590 | | |
1551 | 1591 | | |
1552 | | - | |
| 1592 | + | |
1553 | 1593 | | |
1554 | 1594 | | |
1555 | 1595 | | |
| |||
1573 | 1613 | | |
1574 | 1614 | | |
1575 | 1615 | | |
1576 | | - | |
| 1616 | + | |
| 1617 | + | |
1577 | 1618 | | |
1578 | | - | |
| 1619 | + | |
1579 | 1620 | | |
1580 | 1621 | | |
1581 | 1622 | | |
| |||
1596 | 1637 | | |
1597 | 1638 | | |
1598 | 1639 | | |
1599 | | - | |
| 1640 | + | |
1600 | 1641 | | |
1601 | | - | |
| 1642 | + | |
1602 | 1643 | | |
1603 | | - | |
1604 | | - | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
1605 | 1652 | | |
1606 | 1653 | | |
1607 | 1654 | | |
1608 | | - | |
| 1655 | + | |
1609 | 1656 | | |
1610 | 1657 | | |
1611 | 1658 | | |
| |||
1620 | 1667 | | |
1621 | 1668 | | |
1622 | 1669 | | |
| 1670 | + | |
1623 | 1671 | | |
1624 | 1672 | | |
| 1673 | + | |
1625 | 1674 | | |
1626 | 1675 | | |
1627 | 1676 | | |
| |||
0 commit comments