#990 - Include instructions for testing of CI scripts locally.
Steps on how to test an update to CI scripts locally using Docker is useful to include in the CI README.
This commit is contained in:
@@ -54,4 +54,44 @@ NOTE: Because <ticket> starts with `#`, it must be prefix on the command line wi
|
||||
% git push -f origin release
|
||||
----
|
||||
|
||||
NOTE: You can chain the previous set of commands together using `&&`.
|
||||
NOTE: You can chain the previous set of commands together using `&&`.
|
||||
|
||||
=== Running CI tasks locally
|
||||
|
||||
Since Concourse is built on top of Docker, it's easy to:
|
||||
|
||||
* Debug what went wrong on your local machine.
|
||||
* Test out a a tweak to your `test.sh` script before sending it out.
|
||||
* Experiment against a new image before submitting your pull request.
|
||||
|
||||
All of these use cases are great reasons to essentially run what Concourse does on your local machine.
|
||||
|
||||
IMPORTANT: To do this you must have Docker installed on your machine.
|
||||
|
||||
1. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-hateoas-github openjdk:8-jdk /bin/bash`
|
||||
+
|
||||
This will launch the Docker image and mount your source code at `spring-hateoas-github`.
|
||||
+
|
||||
Next, run the `test.sh` script from inside the container:
|
||||
+
|
||||
2. `PROFILE=none spring-hateoas-github/ci/test.sh`
|
||||
|
||||
Since the container is binding to your source, you can make edits from your IDE and continue to run build jobs.
|
||||
|
||||
If you need to test the `build.sh` script, then do this:
|
||||
|
||||
1. `mkdir /tmp/spring-hateoas-artifactory`
|
||||
2. `docker run -it --mount type=bind,source="$(pwd)",target=/spring-hateoas-github --mount type=bind,source="/tmp/spring-hateoas-artifactory",target=/spring-hateoas-artifactory openjdk:8-jdk /bin/bash`
|
||||
+
|
||||
This will launch the Docker image and mount your source code at `spring-hateoas-github` and the temporary
|
||||
artifactory output directory at `spring-hateoas-artifactory`.
|
||||
+
|
||||
Next, run the `build.sh` script from inside the container:
|
||||
+
|
||||
3. `spring-hateoas-github/ci/build.sh`
|
||||
|
||||
IMPORTANT: `build.sh` doesn't actually push to Artifactory so don't worry about accidentally deploying anything.
|
||||
It just deploys to a local folder. That way, the `artifactory-resource` later in the pipeline can pick up these artifacts
|
||||
and deliver them to artifactory.
|
||||
|
||||
NOTE: Docker containers can eat up disk space fast! From time to time, run `docker system prune` to clean out old images.
|
||||
Reference in New Issue
Block a user