Skip to content

Instantly share code, notes, and snippets.

View HokieGeek's full-sized avatar

Andrés Pérez HokieGeek

View GitHub Profile
#!/bin/bash
# go-scan-monorepo.sh $(find . -type d -maxdepth 1 ! -name '.*')
for d in $@; do
pushd $d >/dev/null
go mod init tmp-$(basename $d)
go build .
ls
rm go.mod go.sum >/dev/null
### Build the code
FROM golang:1.12
ENV GO111MODULE=on GOOS=linux GOARCH=amd64
RUN apt-get update
WORKDIR /go/src/github.com/sonatype/ahab
COPY . .
RUN go install -v -ldflags="-w -s" ./...
### Package it up
FROM ubuntu:latest
#!/bin/sh
token=$1
# awk '/name_with_namespace/ { gsub(/"/, ""); sub(/ \/ /, "%20", $2); print $2 }' RS=, FS=: | \
# curl --silent --request POST --header "PRIVATE-TOKEN: ${token}" "https://gitlab.com/api/v4/projects/${project}/pipeline?ref=master"
# curl --request GET --header "PRIVATE-TOKEN: ${token}" "https://gitlab.com/api/v4/groups/nexus-integration-demo/projects"
# exit 42
curl --request GET --header "PRIVATE-TOKEN: ${token}" "https://gitlab.com/api/v4/groups/nexus-integration-demo/projects" | \
sed 's/namespace:{[^}]*}//g' | awk '$1 ~ /"id"/ { print $2 }' RS=, FS=: | \
while read project; do

How to install

  1. Install the Tampermonkey browser extension
  1. Click here to trigger the extension
  2. Then click the Install button which will show up on your browser similar to the one below.
@HokieGeek
HokieGeek / nexus-iq-support-zip.sh
Last active July 9, 2019 12:44
Generate support zip for Nexus IQ
#!/bin/bash
iq_host=${1:-"http://localhost:8070"}
user_pwd=${2:-"admin:admin123"}
cookies=$(mktemp)
trap 'rm -f ${cookies}' EXIT
## Create session
curl --verbose \
--user ${user_pwd} \
@HokieGeek
HokieGeek / iq-export-policies.sh
Last active July 9, 2019 12:44
Export the policies from Nexus IQ
#!/bin/bash
iq_host=${1:-"localhost:8070"}
user_pwd=${2:-"admin:admin123"}
cookies="/tmp/cookies"
## Create session
curl --verbose \
--user ${user_pwd} \
--cookie-jar ${cookies} --cookie ${cookies} \
@HokieGeek
HokieGeek / README.md
Last active October 25, 2019 13:09
Gradle dependencies with Lifecycle

Usage

  1. Add these tasks to your build.gradle.
  2. In your Jenkins build, add a shell task which executes the line ./gradlew copyDependencies
  3. Add a Invoke Nexus Policy Evaluation, and from the Advanced options add build/dependencies/**/* to the scan locations
@HokieGeek
HokieGeek / iq.yaml
Created February 15, 2019 21:21
Kubernetes configs for Sonatype Nexus
apiVersion: v1
kind: Service
metadata:
name: nexus-iq
labels:
app: nexus-iq
spec:
ports:
- port: 8070
targetPort: 8070
@HokieGeek
HokieGeek / createBlobstore.groovy
Last active May 25, 2022 10:30
Nexus Repo provisioning examples
blobStore.createFileBlobStore('foo', 'bar')
#!/bin/bash
## ./compare-boms.sh ./AnotherCompetitorBOM.xlsx ./dvi-edge-dnp3-Build-20180828-195954.pdf
(( $# < 2 )) && {
echo "ERROR: Not enough arguments" >&2
echo "USAGE: ${0##*/} COMPETITOR_BOM_XLS SONATYPE_REPORT"
exit 1
}