Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom Script Engine #185

Merged
merged 44 commits into from
May 18, 2019
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
2d24508
[skip ci] WIP
tmspzz Mar 11, 2019
ea6d955
Merge branch 'master' into feature/issue-175-role-arn-support
tmspzz Mar 12, 2019
5c177d4
[skip ci][WIP] working version with old behavior
tmspzz Apr 4, 2019
67faa4c
[skip ci] Actually use getAWSEnv
tmspzz Apr 4, 2019
1d00386
[skip ci] remove commented out code
tmspzz Apr 5, 2019
d5e576c
[skip ci] refactor getAWSEnv
tmspzz Apr 12, 2019
a0a546c
[skip ci] Escalate role_arn with STS
tmspzz Apr 13, 2019
3492311
[skip ci][WIP] Add engine key to RomeCacheInfo -- YAML Only
tmspzz Aug 27, 2018
c924f13
WIP
tmspzz Sep 17, 2018
3e61092
Add *.orig to .gitignore
tmspzz Oct 24, 2018
12ad9fb
[WIP] Zip intermediates to file
tmspzz Jan 12, 2019
783868a
Merge branch 'master' into feature/engines
tmspzz Apr 14, 2019
dd1bae0
WIP Probing.hs
BalestraPatrick May 10, 2019
8dc8e00
WIP Engine/Downloading.hs
BalestraPatrick May 11, 2019
45a3fda
More WIP Engine/Downloading.hs
BalestraPatrick May 13, 2019
a853f16
WIP concurrently Engine/Downloading.hs and Version files
BalestraPatrick May 13, 2019
0c1f1cd
WIP Engine/Uploading.hs
BalestraPatrick May 14, 2019
f5f32ed
Fix typos
BalestraPatrick May 14, 2019
ea400fd
WIP Engine/Uploading.hs
BalestraPatrick May 14, 2019
f32774f
Correctly parse Probe command exit code to assume existence of framework
BalestraPatrick May 14, 2019
19cf5b1
Fix writing file before invoking the engine
BalestraPatrick May 14, 2019
e4a1045
WIP in not crashing when script fails to download
BalestraPatrick May 14, 2019
8f33e61
Throw custom error when file is not there
BalestraPatrick May 14, 2019
e7acde4
WIP
BalestraPatrick May 14, 2019
d532c72
Don’t fail when file is not there
BalestraPatrick May 14, 2019
43a1ad0
Remove catch and specify signature of eitherArtifact that we need
BalestraPatrick May 15, 2019
4a3e222
Implement local cache together with engine
BalestraPatrick May 15, 2019
28577f4
Fix warnings and remove unused local path
BalestraPatrick May 15, 2019
c4da191
Add first integration test
BalestraPatrick May 15, 2019
9c9ebc2
More documentation, error messages and fix typos
BalestraPatrick May 16, 2019
0a1c512
Add dynamic frameworks engine yml integration test
BalestraPatrick May 16, 2019
5f82ebc
Merge branch 'master' into feature/engines
BalestraPatrick May 16, 2019
a094411
Improve engine logging messages
BalestraPatrick May 16, 2019
9c583d2
Add engine integration tests to cover all cases (with local Carthage …
BalestraPatrick May 16, 2019
de4d964
Clean up integration tests and add new ones to travis configuration
BalestraPatrick May 16, 2019
abe94fe
Revert useless changes to existing integration tests
BalestraPatrick May 16, 2019
ba34d99
More documentation and style fixes
BalestraPatrick May 16, 2019
8b11049
Address PR comments and hlint warnings
BalestraPatrick May 17, 2019
18232e9
Fix copying of script when running on CI
BalestraPatrick May 17, 2019
dd78baf
Add space in error message “cachein” -> “cache in“
BalestraPatrick May 17, 2019
cd1eaa5
Fix crash in reading INI configuration since engine is unsupported
BalestraPatrick May 17, 2019
9c453c9
Update README with mention and documentation for engine
BalestraPatrick May 18, 2019
62561c5
Update README.md
BalestraPatrick May 18, 2019
42ec412
Update README.md
BalestraPatrick May 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cabal.sandbox.config
*.aux
*.hp
*.eventlog
*.orig
.DS_Store
.stack-work/
.vscode/
Expand Down
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
- stack $ARGS install
- travis_wait 60 bats integration-tests/dynamic-frameworks-ini.bats
- travis_wait 60 bats integration-tests/dynamic-frameworks-yml.bats
- travis_wait 60 bats integration-tests/dynamic-frameworks-engine-yml.bats
- stage: "Build"
name: "Build Rome & Test Current Frameworks"
before_install:
Expand Down Expand Up @@ -80,8 +81,10 @@ jobs:
- stack $ARGS build -j 2
- stack $ARGS sdist
- stack $ARGS install
- travis_wait 60 bats integration-tests/current-framework-yaml.bats
- travis_wait 60 bats integration-tests/current-framework-named-yaml.bats
- travis_wait 60 bats integration-tests/current-framework-yml.bats
- travis_wait 60 bats integration-tests/current-framework-engine-yml.bats
- travis_wait 60 bats integration-tests/current-framework-named-yml.bats
- travis_wait 60 bats integration-tests/current-framework-named-engine-yml.bats
- stage: "Build"
name: "Build Rome & Test Static Frameworks"
before_install:
Expand Down Expand Up @@ -118,6 +121,7 @@ jobs:
- stack $ARGS install
- travis_wait 60 bats integration-tests/static-frameworks-ini.bats
- travis_wait 60 bats integration-tests/static-frameworks-yml.bats
- travis_wait 60 bats integration-tests/static-frameworks-engine-yml.bats

env:
- ARGS="--resolver=lts-13.10"
Expand Down
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Rome is a tool that allows developers on Apple platforms to use:
- [Ceph](https://ceph.com/ceph-storage/object-storage/)
- other S3 compatible object stores
- or/and a local folder
- your own custom engine
BalestraPatrick marked this conversation as resolved.
Show resolved Hide resolved

as a shared cache for frameworks built with [Carthage](https://github.com/Carthage/Carthage).

Expand All @@ -34,6 +35,7 @@ Trusted by:
- [Setting up AWS credentials](#setting-up-aws-credentials)
- [Selecting the AWS Region](#selecting-the-aws-region)
- [Setting up endpoint override for Minio, Ceph, or other S3 compatible stores](#setting-up-endpoint-override)
- [Custom Engine](#customengine)
- [Romefile](#romefile)
- [Cache](#cache)
- [RepositoryMap](#repositorymap)
Expand Down Expand Up @@ -257,6 +259,25 @@ Default port for `http` endpoints is __9000__ if the port is left unspecified.

Alternatively the endpoint can also be specified by setting an `AWS_ENDPOINT` environment variable.

### Custom Engine
BalestraPatrick marked this conversation as resolved.
Show resolved Hide resolved
You can write your own script that Rome will use as engine to execute upload/download/list commands. You start by specifying the path to a script or executable in your [Romefile](#romefile) as shown in the example [structure](#structure).
Rome will invoke the specified script or executable with three commands and different parameters based on the action to perform:

- `./script.sh upload local-path remote-path`
- `./script.sh download remote-path local-path`
- `./script.sh list remote-path`

For example, if your [Romefile](#romefile) specifies `engine: script.sh`, Rome will execute the following command when uploading/downloading/listing a framework:
```sh
./script.sh upload Alamofire/iOS/Alamofire.framework-4.8.2.zip Alamofire/iOS/Alamofire.framework-4.8.2.zip
./script.sh download Alamofire/iOS/Alamofire.framework-4.8.2.zip Alamofire/iOS/Alamofire.framework-4.8.2.zip
./script.sh list Alamofire/iOS/Alamofire.framework-4.8.2.zip
```

The script should take the given `remote-path`, carry out its logic to retrieve the artifact and place it at `local-path`. Please refer to the [cache structure](#cachestructure) definition for more information on the cache is constructed.

For an example of a custom engine, take a look at [engine.sh](https://github.com/blender/Rome/blob/master/integration-tests/engine.sh) which is used in the integration tests to simply copy artifacts in a different directory. Infinite uses cases are opened by using a custom engine, such as uploading artifacts to any non-compatible S3 storage system.

### Romefile

#### About the format
Expand Down Expand Up @@ -299,10 +320,11 @@ A Romefile looks like this:

```yaml
cache: # required
local: ~/Library/Caches/Rome # optional
# at least one between `local` and `s3Bucket` is required
s3Bucket: ios-dev-bucket # optional
# at least one between `local` and `s3Bucket` is required
# at least one of the following is required:
local: ~/Library/Caches/Rome # optional and can be combined with either a `s3Bucket` or `engine`
s3Bucket: ios-dev-bucket # optional and can be combined with `local`
engine: script.sh # optional and can be combined with `local`

repositoryMap: # optional
- better-dog-names: # entry that does not follow
# the "Organization/FrameworkName" convention.
Expand All @@ -326,13 +348,16 @@ currentMap:
The cache __must__ contain __at least one__ between:
- the name of the S3 Bucket to upload/download to/from. The key `s3Bucket` is __optional__.
- the path to local directory to use as an additional cache. The key `local` is __optional__.
- the path to a custom engine to use as an additional cache. The key `engine` is __optional__.

```yaml
cache: # required
local: ~/Library/Caches/Rome # optional
# at least one between `local` and `s3Bucket` is required
# at least one between `local`, `s3bucket` and `engine` is required
s3Bucket: ios-dev-bucket # optional
# at least one between `local` and `s3Bucket` is required
# at least one between `local`, `s3bucket` and `engine` is required
engine: script.sh # optional
# at least one between `local`, `s3bucket` and `engine` is required
```

This is already a viable Romefile.
Expand Down Expand Up @@ -491,7 +516,6 @@ The above means that `t1` is only available for `iOS` and `Mac`.
The `--platforms` command line options can be used to futher limit the Rome command to a
specific subset of the supported platfroms.


### Cache Structure

The following describes the structure of the cache that Rome creates and manages.
Expand Down
3 changes: 3 additions & 0 deletions Rome.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ library
, Caches.Local.Downloading
, Caches.Common
, Network.AWS.Utils
, Engine.Probing
, Engine.Uploading
, Engine.Downloading

build-depends: base >= 4.7 && < 5
, amazonka >= 1.6.1
Expand Down
Loading