Skip to content

a resource for testing; reflects the version it's told, and is able to mirror itself

License

Notifications You must be signed in to change notification settings

concourse/mock-resource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mock Resource

Used for testing resource (and resource type) actions without depending on the outside world.

All source fields and parameters are optional.

Source Configuration

  • mirror_self: For use on task.image_resource, returns itself as an image that tasks can run on.

  • initial_version: Initial version that the resource should emit. Defaults to mock.

  • no_initial_version: Disable initial version, useful for testing resource triggers.

  • force_version: Always emit a version regardless of any param during check.

  • create_files: Example:

    create_files:
      file1.yml: |
        foo: bar
      file2.sh |
        #!/bin/sh
        echo "hello world"
  • check_delay: Amount of time to sleep before returning from the check. Uses Go duration format.

  • check_failure: Force every check to return this error message.

  • metadata: List of name-value pairs to return as metadata on every get and put. Example:

    metadata:
    - name: foo
      value: bar
    - name: baz
      value: qux
  • log: Print a message on every action.

Behavior

check:

If force_version is set, then only that version will ever be emitted, otherwise any version passed into the check is returned. This way you can generate a new version foo by running fly check-resource --resource pipeline/resource --from version:foo.

in:

Since the mock resource is included as a base resource type, it can be used as the image for a task without requiring internet connection (unlike registry-image resource). It can also be used to create files without requiring external state.

Parameters

  • mirror_self_via_params: Same as configuring mirror_self in source when set to true. Default false.

  • create_files_via_params: Similar to create_files in source; merged in so that additional (or replaced) files can be specified.

Files created by the resource

  • ./version: A file containing the version.

  • ./privileged: A file containing a boolean for if the resource was run with elevated privileges.

  • ./rootfs/ and ./metadata.json: Only populated if mirroring self, contains the rootfs and metadata to run this resource as an image.

  • Any files specified by the create files source or param.

out:

Parameters

  • version: Version to create.

  • print_env: Print all environment variables to stdout when set to true. Default false.

  • file: Contents will be read from the file and emitted as the version

About

a resource for testing; reflects the version it's told, and is able to mirror itself

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published