An open API service indexing awesome lists of open source software.

https://github.com/cloudogu/nexus-claim

Define nexus repository structure as code
https://github.com/cloudogu/nexus-claim

cloudogu declarative nexus nexus-claim sonatype sonatype-nexus

Last synced: 6 months ago
JSON representation

Define nexus repository structure as code

Awesome Lists containing this project

README

          

# Nexus Claim

Define your [Sonatype Nexus](http://www.sonatype.org/nexus/) repository structure as code. This script defaults to interact with a nexus server running on [localhost](http://localhost:8081).

## Syntax of nexus-claim on nexus 3

```bash
$ nexus-claim plan -i input.hcl -o output.json
$ nexus-claim apply -i output.json
```

If in case of doubt, issue `nexus-claim --help` to get going.

### Global Options

```
--server value, -s value Url to the nexus server (default: "http://localhost:8081") [$NEXUS_SERVER]
--username value, -u value Username of a nexus admin user (default: "admin") [$NEXUS_USER]
--password value, -p value Password of the nexus user (default: "admin123") [$NEXUS_PASSWORD]
--nexus2 use this flag to use nexus-claim with nexus 2 [$NEXUS_V2]
--help, -h show help
--version, -v print the version
```

## Testing with nexus 3

1. Have a decent version of Golang installed
1. Install Golang dependencies with `go mod vendor && go mod tidy`
1. Build the software in the `target/` directory
- `make clean && make`
1. Start up a local nexus
- `docker run -d -p 8081:8081 --name nexus sonatype/nexus3`
- Access docker container and extract admin password `docker exec -it nexus sh` than `cat /nexus-data/admin.password`
1. Plan a custom repository `.hcl` file
- `target/nexus-claim --password "" plan -i resources/nexus3/nexus_custom_example.hcl -o targetState.json`
- this reads existing repositories from the nexus, changes from the given `.hcl` file will make up the target state as JSON
- the target state is supposed to be created within the nexus-claim application
1. Apply target state `.json` file to nexus
1. an auto-generated `.groovy` file responsible for interacting with the nexus API in terms of creating will be uploaded in the nexus.
1. the `.groovy file` responsible for creation will be called with the target `.json` being the argument
1. The repository changes are being written. Check the nexus frontend for changes.

## Things to consider for .hcl of nexus 3

- on maven2-hosted- and maven2-proxy-repository there must be a maven sector in addition(with versionPolicy and writePolicy)
- Note the autogenerated `.groovy` files are only an interaction layer and should not contain larger application logic

## Configuration Examples

### nexus 3

Examples can be found in the [nexus 3 resources directory](resources/nexus3/nexus_custom.hcl). Also available in the same directory are resulting target `.json` files for reference.

### nexus 2

Examples can be found in the [nexus 2 resources directory](resources/nexus2/nexus-initial-example.hcl)

---

## What is the Cloudogu EcoSystem?
The Cloudogu EcoSystem is an open platform, which lets you choose how and where your team creates great software. Each service or tool is delivered as a Dogu, a Docker container. Each Dogu can easily be integrated in your environment just by pulling it from our registry.

We have a growing number of ready-to-use Dogus, e.g. SCM-Manager, Jenkins, Nexus Repository, SonarQube, Redmine and many more. Every Dogu can be tailored to your specific needs. Take advantage of a central authentication service, a dynamic navigation, that lets you easily switch between the web UIs and a smart configuration magic, which automatically detects and responds to dependencies between Dogus.

The Cloudogu EcoSystem is open source and it runs either on-premises or in the cloud. The Cloudogu EcoSystem is developed by Cloudogu GmbH under [AGPL-3.0-only](https://spdx.org/licenses/AGPL-3.0-only.html).

## License
Copyright © 2020 - present Cloudogu GmbH
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
See [LICENSE](LICENSE) for details.

---
MADE WITH :heart: FOR DEV ADDICTS. [Legal notice / Imprint](https://cloudogu.com/en/imprint/?mtm_campaign=ecosystem&mtm_kwd=imprint&mtm_source=github&mtm_medium=link)