Skip to content

Instantly share code, notes, and snippets.

@monodot
Last active March 2, 2017 12:28
Show Gist options
  • Save monodot/e221fc4daaa6e3650e96155435f1f06b to your computer and use it in GitHub Desktop.
Save monodot/e221fc4daaa6e3650e96155435f1f06b to your computer and use it in GitHub Desktop.
Using jq, set the MAVEN_MIRROR_URL env variable in a BuildConfig in an OpenShift list of objects
# Useful if you are running a local Maven mirror (e.g. Nexus) for dependencies
# Speeds up builds in OpenShift
# Of particular interest if you're developing with JBoss Middleware images
#
# Uses `ipconfig` to get the IP address of your host machine
# Updates a BuildConfig element to set the env var MAVEN_MIRROR_URL
#
# Requires:
# - jq
HOST_IP=$(ipconfig getifaddr en0) bash -c "cat resources.json | jq '(.items[] | select(.kind == \"BuildConfig\") | .spec.strategy.sourceStrategy.env) |= . + [{\"name\": \"MAVEN_MIRROR_URL\", \"value\": \"http://${HOST_IP}:8081/nexus/content/groups/public/\"}]'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment