diff --git a/README.md b/README.md index a752c2a..dc8e16d 100644 --- a/README.md +++ b/README.md @@ -3,94 +3,6 @@ For information about the Artifactory Gatekeeper plugin, see the Snyk user docs, [Artifactory Gatekeeper plugin](https://docs.snyk.io/integrations/private-registry-gatekeeper-plugins/artifactory-gatekeeper-plugin-overview). -## Setup local development environment - -### Download an Artifactory Docker image: - -``` -docker pull releases-docker.jfrog.io/jfrog/artifactory-pro:latest -``` - -Does not have to be `pro`, but in this example we'll do it. - -### Create a `$JFROG_HOME` folder - -``` -mkdir -p ~/.jfrog/artifactory/var/ -``` - -Export it to your environment for ease of use - -``` -echo export JFROG_HOME=~/.jfrog >> ~/.zshrc -``` - -### Build the plugin - -Depends a lot on your system. But something like - -``` -mvn install -DskipTests -``` - -Will probably work. Per default, you'll find a baked `.zip` -in `~/.m2/repository/io/snyk/plugins/artifactory/distribution/LOCAL-SNAPSHOT`. - -Unzip it. Inside is a `.groovy` file, a `.properties` file, as well as the actual `.jar` inside `/lib`. - -Edit the `.properties`, add something like this to the properties for a minimum working solution: - -``` -snyk.api.token= -snyk.api.organization= -``` - -Also, if you want to test against your local Registry, but you're running on Docker: - -``` -snyk.api.url=http://host.docker.internal:8000/api/v1/ -``` - -At least if you're on OSX, you cannot probe against `localhost` from within a Docker container. - -Also, remember to activate some of the scanners depending on what you're debugging: - -``` -snyk.scanner.packageType.maven=true -snyk.scanner.packageType.npm=true -snyk.scanner.packageType.pypi=true -``` - -### Enable debugging JVM options - -``` -vim $JFROG_HOME/artifactory/var/etc/system.yaml -``` - -Add `extraJavaOpts` - -``` -shared: - ## Java 17 distribution to use - #javaHome: "JFROG_HOME/artifactory/app/third-party/java" - - ## Extra Java options to pass to the JVM. These values add to or override the defaults. - #extraJavaOpts: "-Xms512m -Xmx4g" - extraJavaOpts: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" -``` - -### Run the Docker image - -And ensure you expose debugging ports, in this case, `5005` - -``` -docker run -d --name artifactory -p 8888:8082 -p 8081:8081 -p 5005:5005 -v $JFROG_HOME/artifactory/var/:/var/opt/jfrog/artifactory releases-docker.jfrog.io/jfrog/artifactory-pro:latest -``` - -Wait until the Docker has loaded, it can take a while. Check the progress with `docker logs -f `. - -#### Notice for M1 Macs - -You'll have a ton of trouble if you default to building your Docker images as `linux/amd64`. At least I had. Ensure you -do not have a env variable like `DOCKER_DEFAULT_PLATFORM=linux/amd64` enabled when pulling and/or running the image. +## Local development environment +See [the docs](./local-dev/README.md). diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 98cfd0e..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: "3.7" -services: - - artifactory: - image: releases-docker.jfrog.io/jfrog/artifactory-pro:7.12.5 - environment: - - EXTRA_JAVA_OPTIONS="-agentlib:jdwp=transport=dt_socket,address=8882,server=y,suspend=n" - ports: - - "8081:8081" - - "8082:8082" - - "8882:8882" - volumes: - - "./distribution/docker/artifactory:/var/opt/jfrog/artifactory" diff --git a/local-dev/.gitignore b/local-dev/.gitignore new file mode 100644 index 0000000..99c6992 --- /dev/null +++ b/local-dev/.gitignore @@ -0,0 +1 @@ +artifactory-docker-compose/ diff --git a/local-dev/README.md b/local-dev/README.md new file mode 100644 index 0000000..65c18e0 --- /dev/null +++ b/local-dev/README.md @@ -0,0 +1,26 @@ +# Local development + +## Running artifactory locally +Artifactory pro is required to run this plugin. If you want to try it out, +you can sign up for free on the [JFrog website](https://jfrog.com/start-free/) +and download a self-hosted version powered by Docker Compose. + +Follow the installation instructions to run artifactory. +The `artifactory-docker-compose` folder, which is .gitignored, +can be used to extract artifactory to. + +## Installing the plugin +Build it first: + +```shell +mvn install -DskipTests +``` + +Unpack the release into artifactory's plugins folder: + +```shell +unzip -o distribution/target/artifactory-snyk-security-plugin-LOCAL-SNAPSHOT.zip -d local-dev/artifactory-docker-compose/artifactory/var/etc/artifactory/ +``` + +Restart Artifactory and check the logs to confirm the plugin gets loaded. +