This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.sonatype.nexus.repository.storage.Asset; | |
import org.sonatype.nexus.repository.storage.Component; | |
import org.sonatype.nexus.repository.storage.Query; | |
import org.sonatype.nexus.repository.storage.StorageFacet; | |
import org.sonatype.nexus.repository.storage.Query.Builder; | |
import groovy.json.JsonOutput; | |
import groovy.json.JsonSlurper; | |
def request = new JsonSlurper().parseText(args); | |
assert request.repoName: 'repoName parameter is required'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- generate ssh key for gitlab-runner user | |
- add ssh key to project's deploy keys (project/setting/repository) | |
add below commands into script section of .gitlab-ci.yml file. | |
# CI_REPOSITORY_URL contains gitlab-ci-token. replace start of the string up to '@' with git@' and append a ':' before first '/' | |
# example | |
# CI_REPOSITORY_URL=https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@example.com/gitlab-examples/ci-debug-trace.git | |
# should be git@example.com:/gitlab-examples/ci-debug-trace.git | |
- export PUSH_REPO=$(echo "$CI_REPOSITORY_URL" | sed -e "s|.*@\(.*\)|git@\1|" -e "s|/|:/|" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# go to project directory in gitlab host machine | |
cd ~git/git-data/repositories/path/to/project/project.git | |
# make a directory named custom_hooks | |
mkdir custom_hooks | |
cd custom_hooks | |
cp /path/to/hook-file . | |
# put hook file into this directory | |
# and make it executable | |
chmod +x hook-file |