Skip to content

Commit

Permalink
conflict resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
NorseGaud committed Jun 17, 2020
2 parents 2111e93 + 0188a76 commit 040c659
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ jobs:
echo "HERE" && \
echo "THERE HERE WHERE"
host-pre-commands: "env && echo PRE COMMANDS"
host-post-commands: "echo POST COMMANDS && echo \"CWD: $(pwd)\""
host-post-commands: |
echo POST COMMANDS
echo \"CWD: $(pwd)\"
anka-start-options: "-f"
anka-run-options: "--workdir /tmp"
host-command-options: |
Expand Down
53 changes: 28 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,53 +34,55 @@ jobs:
The above example will clone your project repo to the github action runner's working directory, pull the Template `10.15.4` and Tag `base:port-forward-22:xcode11-v1` from the Registry, prepare an Anka VM using that Template and Tag, execute the commands inside of the VM ensuring Environment Variables are passed in with `anka-run-options: "--env"`, and then upload artifacts `./log.txt` and `./build/binaryfile-v1` from the current directory (which is mounted by default into the VM).

> **Build and Test time can be significantly impacted by the default host -> guest mount. It's suggested that you use `anka-run-options: "--wait-network --wait-time --no-volume"` and then git clone your repo inside of `commands:`. Or, if you need to upload artifacts (requires they exist on the host), just cd out of the mounted directory (`/private/var/tmp/ankafs.0`) inside of the VM and then do the git clone so you can execute your builds and tests. This allows you to then move the files you want to upload as an artifact back into the mounted directory so they are seen on the host.**
**Build and test time can be significantly impacted by the default host -> guest mount.** It's suggested that you use `anka-run-options: "--wait-network --wait-time --no-volume"` and then git clone your repo inside of `commands:`. Or, if you need to upload artifacts (requires they exist on the host), just cd out of the mounted directory (`/private/var/tmp/ankafs.0`) inside of the VM and then do the git clone so you can execute your builds and tests. This allows you to then move the files you want to upload as an artifact back into the mounted directory so they are seen on the host.**

### Inputs

These are defined under the `with:` mapping key inside of your workflow yaml.

#### `anka-template`
#### `anka-template` (string) (required)
- **Name or UUID of your Anka Template**
- **[Required]**
#### `commands`
#### `commands` (multi-line string or regular string) (required)
- **Commands you wish to run inside of the Anka VM**
- **[Required]**
- You can use `commands: |` for multi-line input or a simple string
#### `anka-tag`
- **Name of Anka Tag (optional)**
- defaults to latest tag
#### `anka-custom-vm-label`
- You need to escape double quotes `\"`
- You need to escape any dollar signs `\$` so that it doesn't interpolate from the host side. Unless of course you wish to pass in something from the host into the VM.
#### `anka-tag` (string) (optional)
- **Name of Anka Tag**
- Defaults to latest tag
#### `anka-custom-vm-label` (string) (optional)
- **Label for the cloned VM that will execute your code**
- Defaults to `github-actions-${GITHUB_REPOSITORY}-${GITHUB_RUN_NUMBER}-${GITHUB_JOB}-${GITHUB_ACTION}`
- Your custom label will have a random number added to the end of it to prevent collisions when two VMs are running on the same node with the same label
#### `host-pre-commands`
#### `host-pre-commands` (string) (optional)
- **Commands you wish to run outside on the node (host) BEFORE preparation of and execution inside the VM**
#### `host-post-commands`
- You need to escape double quotes `\"`
#### `host-post-commands` (string) (optional)
- **Commands you wish to run outside on the node (host) AFTER preparation of and execution inside the VM**
#### `anka-start-options`
- You need to escape double quotes `\"`
#### `anka-start-options` (string) (optional)
- **Options set for the anka start execution**
#### `anka-run-options`
#### `anka-run-options` (string) (optional)
- **Options set for anka run execution**
#### `anka-registry-pull-options`
#### `anka-registry-pull-options` (string) (optional)
- **Options set for anka registry pull execution**
#### `host-command-options`
#### `host-command-options` (string; js object or JSON) (optional)
- **Options to use for github actions exec command**
- Must be a js object (do not use single quotes to wrap values `{ cwd: 'This Wont Work' }`) or JSON (`{ "cwd": "./pathOnHostToRunAnkaCommands" }`) inside of a string
- Do not use single quotes to wrap values `{ cwd: 'This Wont Work' }`
- Supported options: https://github.com/actions/toolkit/blob/master/packages/exec/src/interfaces.ts
#### `lock-file-location`
#### `lock-file-location` (string) (optional)
- **Location where the pull/clone lock file exists**
- Defaults to /tmp
#### `artifact-files`
- Defaults to "/tmp"
#### `artifact-files` (multi-line string) (optional)
- **Each file you wish to upload and include in the final artifact, newline separated**
- Requires a host <-> guest mounted volume so that the artifact creation/upload code, running on the host, can see the artifacts that were created inside of the VM.
#### `artifact-archive-file-name`
- Requires the default host <-> guest mounted volume so that the artifact creation/upload code, running on the host, can see the files you specify and are created inside of the VM.
#### `artifact-archive-file-name` (string) (optional)
- **Name of the artifact (archive) that contains all of the files specified in the `artifact-files` input**
- Defaults to "artifact"
#### `artifacts-root-directory`
#### `artifacts-root-directory` (string) (optional)
- **An absolute or relative file path that denotes the root parent directory of the files being uploaded**
- Defaults to "./"
#### `skip-registry-pull`
#### `skip-registry-pull` (boolean) (optional)
- **Skip the registry pull; useful if you do not have a registry or it is down but the Template + Tag are already on the node**

### Outputs
Expand All @@ -93,7 +95,8 @@ These are returned to your workflow.yaml so that subsequent steps can use them.

Usage:

```
```yaml
jobs:
functional-tests-second-agent:
runs-on: [self-hosted, macOS]
needs: prep
Expand All @@ -103,7 +106,7 @@ Usage:
run: "sleep 20"
- name: pull test 2
id: pull-test-2
uses: veertuinc/anka-vm-github-action@v1.0.0-beta
uses: veertuinc/anka-vm-github-action@v1.1.0-beta
with:
anka-template: "10.15.4"
anka-tag: "base:port-forward-22"
Expand Down

0 comments on commit 040c659

Please sign in to comment.