├── .circleci
├── .maven.xml
├── circleci-readme.md
└── config.yml
├── .github
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── CONTRIBUTORS.md
├── Dockerfile
├── LICENSE.txt
├── README.md
├── header.txt
├── headers.sh
├── nexus-repository-helm-it
├── pom.xml
└── src
│ └── test
│ ├── java
│ └── org
│ │ └── sonatype
│ │ └── nexus
│ │ └── plugins
│ │ └── helm
│ │ ├── HelmITConfig.java
│ │ ├── internal
│ │ ├── HelmClient.java
│ │ ├── HelmHostedIT.java
│ │ ├── HelmITSupport.java
│ │ ├── HelmProxyIT.java
│ │ ├── HelmRoutingRuleIT.java
│ │ ├── cleanup
│ │ │ └── CleanupTaskHelmIT.java
│ │ ├── content
│ │ │ ├── HelmClient.java
│ │ │ ├── HelmContentHostedIT.java
│ │ │ ├── HelmContentITSupport.java
│ │ │ ├── HelmContentProxyIT.java
│ │ │ └── fixtures
│ │ │ │ ├── HelmRepoRecipes.groovy
│ │ │ │ └── RepositoryRuleHelm.groovy
│ │ ├── fixtures
│ │ │ ├── HelmRepoRecipes.groovy
│ │ │ └── RepositoryRuleHelm.groovy
│ │ └── restore
│ │ │ └── HelmRestoreBlobIT.java
│ │ └── rest
│ │ ├── HelmResourceIT.java
│ │ └── ResourceITSupport.java
│ └── resources
│ └── helm
│ ├── index.yaml
│ ├── mongodb-4.0.4.tgz
│ ├── mongodb-6.0.0.tgz
│ └── mongodb-7.2.8.tgz
├── nexus-repository-helm
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── sonatype
│ │ │ └── repository
│ │ │ └── helm
│ │ │ ├── HelmAttributes.java
│ │ │ ├── HelmRestoreFacet.java
│ │ │ ├── HelmUploadHandlerSupport.java
│ │ │ ├── api
│ │ │ ├── HelmHostedRepositoryApiRequest.java
│ │ │ └── HelmProxyRepositoryApiRequest.java
│ │ │ ├── internal
│ │ │ ├── AssetKind.java
│ │ │ ├── HelmFormat.java
│ │ │ ├── HelmRecipeSupport.groovy
│ │ │ ├── cleanup
│ │ │ │ └── HelmCleanupPolicyConfiguration.java
│ │ │ ├── content
│ │ │ │ ├── HelmContentFacet.java
│ │ │ │ ├── HelmUploadHandler.java
│ │ │ │ ├── browse
│ │ │ │ │ ├── HelmBrowseModule.java
│ │ │ │ │ ├── HelmBrowseNodeDAO.java
│ │ │ │ │ └── HelmBrowseNodeGenerator.java
│ │ │ │ ├── createindex
│ │ │ │ │ ├── CreateIndexFacetImpl.java
│ │ │ │ │ ├── CreateIndexService.java
│ │ │ │ │ └── CreateIndexServiceImpl.java
│ │ │ │ ├── metadata
│ │ │ │ │ └── IndexYamlAbsoluteUrlRewriter.java
│ │ │ │ ├── package-info.java
│ │ │ │ ├── recipe
│ │ │ │ │ ├── HelmContentFacetImpl.java
│ │ │ │ │ ├── HelmHostedFacet.java
│ │ │ │ │ ├── HelmHostedFacetImpl.java
│ │ │ │ │ ├── HelmHostedRecipe.groovy
│ │ │ │ │ ├── HelmProxyFacet.java
│ │ │ │ │ ├── HelmProxyRecipe.groovy
│ │ │ │ │ └── HostedHandlers.java
│ │ │ │ └── store
│ │ │ │ │ ├── HelmAssetBlobDAO.java
│ │ │ │ │ ├── HelmAssetDAO.java
│ │ │ │ │ ├── HelmComponentDAO.java
│ │ │ │ │ ├── HelmContentRepositoryDAO.java
│ │ │ │ │ └── HelmStoreModule.java
│ │ │ ├── createindex
│ │ │ │ ├── CreateIndexFacet.java
│ │ │ │ └── HelmIndexInvalidationEvent.java
│ │ │ ├── database
│ │ │ │ └── HelmProperties.java
│ │ │ ├── metadata
│ │ │ │ ├── ChartEntry.java
│ │ │ │ ├── ChartIndex.java
│ │ │ │ ├── IndexYamlAbsoluteUrlRewriter.java
│ │ │ │ └── IndexYamlAbsoluteUrlRewriterSupport.java
│ │ │ ├── orient
│ │ │ │ ├── HelmComponentDirector.java
│ │ │ │ ├── HelmComponentMaintenanceFacet.java
│ │ │ │ ├── HelmFacet.java
│ │ │ │ ├── HelmFacetImpl.java
│ │ │ │ ├── HelmUploadHandler.java
│ │ │ │ ├── createindex
│ │ │ │ │ ├── CreateIndexFacetImpl.java
│ │ │ │ │ ├── CreateIndexService.java
│ │ │ │ │ └── CreateIndexServiceImpl.java
│ │ │ │ ├── hosted
│ │ │ │ │ ├── HelmHostedFacet.java
│ │ │ │ │ ├── HelmHostedFacetImpl.java
│ │ │ │ │ ├── HelmHostedRecipe.groovy
│ │ │ │ │ ├── HelmHostedWritePolicySelector.java
│ │ │ │ │ └── HostedHandlers.java
│ │ │ │ ├── metadata
│ │ │ │ │ └── IndexYamlBuilder.java
│ │ │ │ ├── package-info.java
│ │ │ │ ├── proxy
│ │ │ │ │ ├── HelmProxyFacetImpl.java
│ │ │ │ │ └── HelmProxyRecipe.groovy
│ │ │ │ └── restore
│ │ │ │ │ └── HelmRestoreFacetImpl.java
│ │ │ ├── security
│ │ │ │ ├── HelmFormatSecurityContributor.java
│ │ │ │ └── HelmSecurityFacet.java
│ │ │ ├── ui
│ │ │ │ └── UiPluginDescriptorImpl.java
│ │ │ └── util
│ │ │ │ ├── HelmAttributeParser.java
│ │ │ │ ├── HelmPathUtils.java
│ │ │ │ ├── ProvenanceParser.java
│ │ │ │ ├── TgzParser.java
│ │ │ │ └── YamlParser.java
│ │ │ └── rest
│ │ │ ├── HelmHostedRepositoriesApiResource.java
│ │ │ ├── HelmHostedRepositoriesApiResourceBeta.java
│ │ │ ├── HelmHostedRepositoriesApiResourceV1.java
│ │ │ ├── HelmProxyRepositoriesApiResource.java
│ │ │ ├── HelmProxyRepositoriesApiResourceBeta.java
│ │ │ └── HelmProxyRepositoriesApiResourceV1.java
│ └── resources
│ │ └── static
│ │ └── rapture
│ │ ├── NX
│ │ └── helm
│ │ │ ├── app
│ │ │ ├── PluginConfig.js
│ │ │ └── PluginStrings.js
│ │ │ ├── controller
│ │ │ └── SearchHelm.js
│ │ │ ├── util
│ │ │ └── HelmRepositoryUrls.js
│ │ │ └── view
│ │ │ └── repository
│ │ │ └── recipe
│ │ │ ├── HelmHosted.js
│ │ │ └── HelmProxy.js
│ │ └── resources
│ │ └── nexus-repository-helm-debug.css
│ └── test
│ ├── java
│ └── org
│ │ └── sonatype
│ │ └── repository
│ │ └── helm
│ │ └── internal
│ │ ├── HelmAssetAttributePopulatorTest.java
│ │ ├── HelmFormatTest.java
│ │ ├── HelmListTestHelper.java
│ │ ├── HelmRecipeTest.java
│ │ ├── content
│ │ └── createindex
│ │ │ └── CreateIndexServiceImplTest.java
│ │ ├── metadata
│ │ └── ChartIndexTest.java
│ │ ├── orient
│ │ ├── ComponentDirectorTest.java
│ │ ├── createindex
│ │ │ └── CreateIndexServiceImplTest.java
│ │ └── metadata
│ │ │ ├── IndexYamlAbsoluteUrlRewriterTest.java
│ │ │ └── IndexYamlBuilderTest.java
│ │ ├── security
│ │ └── HelmSecurityFacetTest.java
│ │ └── util
│ │ ├── HelmAttributeParserTest.java
│ │ ├── HelmPathUtilsTest.java
│ │ ├── ProvenanceParserTest.java
│ │ ├── TgzParserTest.java
│ │ └── YamlParserTest.java
│ └── resources
│ └── org
│ └── sonatype
│ └── repository
│ └── helm
│ └── internal
│ ├── orient
│ └── metadata
│ │ ├── index.yaml
│ │ ├── indexWithCustomUrls.yaml
│ │ └── indexWithRelativeUrls.yaml
│ └── util
│ ├── Chart.yaml
│ ├── Chart.yml
│ ├── indexresult.yaml
│ ├── mongodb-0.4.9.tgz
│ ├── mongodb-4.0.4.tgz
│ ├── moodle-0.1.4.tgz
│ ├── mysql-1.4.0.tgz.prov
│ └── mysql_negative-1.4.0.tgz
├── nexus-restore-helm
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── org
│ │ └── sonatype
│ │ └── nexus
│ │ └── blobstore
│ │ └── restore
│ │ └── helm
│ │ └── internal
│ │ ├── HelmRestoreBlobData.java
│ │ └── HelmRestoreBlobStrategy.java
│ └── test
│ └── java
│ └── org
│ └── sonatype
│ └── nexus
│ └── blobstore
│ └── restore
│ └── helm
│ └── internal
│ └── HelmRestoreBlobStrategyTest.java
└── pom.xml
/.circleci/.maven.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | rso
7 | ${env.SONATYPE_USERNAME}
8 | ${env.SONATYPE_PASSWORD}
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.circleci/circleci-readme.md:
--------------------------------------------------------------------------------
1 | CI Debug Notes
2 | ================
3 | To validate some circleci stuff, I was able to run a “build locally” using the steps below.
4 | The local build runs in a docker container.
5 |
6 | * (Once) Install circleci client (`brew install circleci`)
7 |
8 | * Convert the “real” config.yml into a self contained (non-workspace) config via:
9 |
10 | circleci config process .circleci/config.yml > .circleci/local-config.yml
11 |
12 | * Run a local build with the following command:
13 |
14 | circleci local execute -c .circleci/local-config.yml --job 'github-maven-deploy/build-and-test'
15 |
16 | With the above command, operations that cannot occur during a local build will show an error like this:
17 |
18 | ```
19 | ... Error: FAILED with error not supported
20 | ```
21 |
22 | However, the build will proceed and can complete “successfully”, which allows you to verify scripts in your config, etc.
23 |
24 | If the build does complete successfully, you should see a happy yellow `Success!` message.
25 |
26 | Miscellaneous
27 | -------------
28 |
29 | * Write Key setup
30 |
31 | To allow your CI build to push changes back to github (e.g. release tags, etc), you need to create
32 | a github **Deploy Key** with **write** access. The command below will create such a key. Use an empty password.
33 | See: [CircleCI-Add ssh key](https://circleci.com/docs/2.0/add-ssh-key/#steps) for more details.
34 |
35 | 1. Generate a new ssh key:
36 |
37 | ssh-keygen -m PEM -t rsa -b 4096 -C "community-group@sonatype.com" -f _github_rsa.key
38 |
39 | 2. Copy the public key to your clipboard:
40 |
41 | cat _github_rsa.key.pub | pbcopy
42 |
43 | Paste the public key into a new **write** enabled **GitHub deploy key** with Title: `CircleCI Write `
44 |
45 | Be sure you check the "Allow write access" option.
46 | Did I mention this key needs write access? (Don't ask how many times I forgot this).
47 |
48 | 3. Copy the private key to your clipboard:
49 |
50 | cat _github_rsa.key | pbcopy
51 |
52 | In the CircleCI Web UI, under Project Settings (top right gear) -> SSH Keys -> Additional SSH Keys -> Add SSH Key,
53 | enter "Hostname": `github.com`
54 |
55 | Paste the private key.
56 |
57 | As a sanity check, the private key should end with `-----END RSA PRIVATE KEY-----`.
58 |
59 | 4. Update the `ssh-fingerprints:` tag in your [config.yml](config.yml) to the fingerprint of the write key.
60 | This fingerprint is visible in the CircleCI web ui after you add the private key.
61 |
--------------------------------------------------------------------------------
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2.1
2 |
3 | orbs:
4 | github-maven-deploy: github-maven-deploy/github-maven-deploy@1.0.5
5 | circleci-maven-release-orb: sonatype-nexus-community/circleci-maven-release-orb@0.0.15
6 |
7 | build-and-test-commands: &build-and-test-commands
8 | mvn-build-test-command: mvn clean verify -PbuildKar -Dit
9 | mvn-collect-artifacts-command: |
10 | mkdir -p ~/project/artifacts/junit/
11 | find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/project/artifacts/junit/ \;
12 | find . -type f -regex ".*/target/failsafe-reports/.*xml" -exec cp {} ~/project/artifacts/junit/ \;
13 |
14 | release-args: &release-args
15 | mvn-release-perform-command: mvn --batch-mode release:perform -s .circleci/.maven.xml -PbuildKar,circle-ci-release
16 | ssh-fingerprints: "eb:b1:b6:cc:59:57:91:13:4c:b5:11:98:49:d8:1e:ba"
17 | context: rso-base
18 | filters:
19 | branches:
20 | only: master
21 |
22 | workflows:
23 | build-branch:
24 | jobs:
25 | - github-maven-deploy/build-and-test:
26 | <<: *build-and-test-commands
27 | filters:
28 | branches:
29 | ignore: master
30 |
31 | run-release:
32 | jobs:
33 | - approve-release:
34 | type: approval
35 | filters:
36 | branches:
37 | only: master
38 | - circleci-maven-release-orb/run-maven-release:
39 | requires:
40 | - approve-release
41 | <<: *release-args
42 |
43 | release-from-master:
44 | jobs:
45 | - github-maven-deploy/build-and-test:
46 | <<: *build-and-test-commands
47 | filters:
48 | branches:
49 | only: master
50 | - circleci-maven-release-orb/run-maven-release:
51 | requires:
52 | - github-maven-deploy/build-and-test
53 | <<: *release-args
54 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
15 | ## How to be a contributor to this project
16 |
17 | ### Are you submitting a pull request?
18 |
19 | * Use [our codestyle](https://github.com/sonatype/codestyle). If we get a PR that doesn't match it, there will be
20 | much shaming throughout the land. If you use an editor besides Eclipse or IntelliJ, adapt the codestyle and submit a PR
21 | there :)
22 | * Fill out a CLA for us, so we can sort out all the legal parts of contributing. You can get all the information for
23 | this [here](https://help.sonatype.com/display/NXRM3/Bundle+Development#BundleDevelopment-ContributingBundles). You may go, this is for your book, is it
24 | applicable for this repo? Yes, absolutely. Follow the CLA process and email in your form. We are working on a way to
25 | make this simpler, as well.
26 | * Make sure to fill out an issue for your PR, so that we have traceability as to what you are trying to fix,
27 | versus how you fixed it.
28 | * Try to fix one thing per pull request! Many people work on this code, so the more focused your changes are, the less
29 | of a headache other people will have when they merge their work in.
30 | * Make sure to add yourself or your organization to CONTRIBUTORS.md as a part of your PR, if you are new to the project!
31 | * If you're stuck, ask our [gitter channel](https://gitter.im/sonatype/nexus-developers)! There are a number of
32 | experienced programmers who are happy to help with learning and troubleshooting.
33 |
34 | ### Are you new and looking to dive in?
35 |
36 | * Check our issues to see if there is something you can dive in to.
37 | * Come hang out with us at our [gitter channel](https://gitter.im/sonatype/nexus-developers).
38 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Thanks for creating an issue! Please fill out this form so we can be
2 | sure to have all the information we need, and to minimize back and forth.
3 |
4 | * **What are you trying to do?**
5 |
6 | * **What feature or behavior is this required for?**
7 |
8 | * **How could we solve this issue? (Not knowing is okay!)**
9 |
10 | * **Anything else?**
11 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | (brief, plain english overview of your changes here)
2 |
3 | This pull request makes the following changes:
4 | * (your change here)
5 | * (another change here)
6 | * (etc)
7 |
8 | (If there are changes to the UI, please include a screenshot so we
9 | know what to look for!)
10 |
11 | (If there are changes to user behavior in general, please make sure to
12 | update the docs, as well)
13 |
14 | It relates to the following issue #s:
15 | * Fixes #X
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Eclipse
2 | .classpath
3 | .project
4 | .settings/
5 |
6 | # Maven
7 | target/
8 | *.ser
9 | *.ec
10 | .mvn/timing.properties
11 | .mvn/extensions.xml
12 | .mvn/maven.config
13 |
14 | # Intellij
15 | *.ipr
16 | *.iml
17 | *.iws
18 | .idea/
19 |
20 | # OrientDB
21 | .orientdb_history
22 |
23 | # Other
24 | .DS_Store
25 | .clover
26 | *.log
27 | /*.rc
28 | atlassian-ide-plugin.xml
29 | dependency-reduced-pom.xml
30 | out
31 | # ci config for local ci build
32 | /.circleci/local-config.yml
33 |
--------------------------------------------------------------------------------
/CONTRIBUTORS.md:
--------------------------------------------------------------------------------
1 |
15 | A lot of awesome people have contributed to this project! Here they are:
16 |
17 | Sonatype internal people, in alphabetical order by username:
18 |
19 | * [@DarthHater](https://github.com/darthhater/) (Jeffry Hesse)
20 | * [@doddi](https://github.com/doddi/) (Mark Dodgson)
21 | * [@mlukaretkyi](https://github.com/mlukaretkyi) (Maksym Lukaretkyi)
22 |
23 | External contributors:
24 |
25 | 
26 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # declaration of NEXUS_VERSION must appear before first FROM command
2 | # see: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
3 | ARG NEXUS_VERSION=latest
4 |
5 | FROM maven:3-jdk-8-alpine AS build
6 |
7 | COPY . /nexus-repository-helm/
8 | RUN cd /nexus-repository-helm/; \
9 | mvn clean package -PbuildKar;
10 |
11 | FROM sonatype/nexus3:$NEXUS_VERSION
12 |
13 | ARG DEPLOY_DIR=/opt/sonatype/nexus/deploy/
14 | USER root
15 | COPY --from=build /nexus-repository-helm/nexus-repository-helm/target/nexus-repository-helm-*-bundle.kar ${DEPLOY_DIR}
16 | USER nexus
17 |
--------------------------------------------------------------------------------
/header.txt:
--------------------------------------------------------------------------------
1 | Sonatype Nexus (TM) Open Source Version
2 | Copyright (c) ${project.inceptionYear}-present Sonatype, Inc.
3 | All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
4 |
5 | This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
6 | which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
7 |
8 | Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
9 | of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
10 | Eclipse Foundation. All other trademarks are the property of their respective owners.
11 |
--------------------------------------------------------------------------------
/headers.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | dirname=`dirname $0`
3 | dirname=`cd "$dirname" && pwd`
4 | cd "$dirname"
5 |
6 | op=$1; shift
7 | case "$op" in
8 | 'check' | 'format')
9 | ;;
10 | *)
11 | echo "usage: `basename $0` { check | format } [mvn-options]"
12 | exit 1
13 | esac
14 |
15 | # still depends on profiles defined in https://github.com/sonatype/buildsupport/blob/master/pom.xml
16 | mvn -f ./pom.xml -N -P license-${op} "$@"
17 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/HelmITConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm;
14 |
15 | import org.sonatype.nexus.pax.exam.NexusPaxExamSupport;
16 | import org.sonatype.nexus.testsuite.testsupport.NexusITSupport;
17 |
18 | import org.ops4j.pax.exam.Option;
19 |
20 | import static org.ops4j.pax.exam.CoreOptions.systemProperty;
21 | import static org.sonatype.nexus.pax.exam.NexusPaxExamSupport.nexusFeature;
22 |
23 | public class HelmITConfig
24 | {
25 | public static Option[] configureHelmBase() {
26 | return NexusPaxExamSupport.options(
27 | NexusITSupport.configureNexusBase(),
28 | nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-helm"),
29 | systemProperty("nexus-exclude-features").value("nexus-cma-community, nexus-community-feature")
30 | );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/HelmClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal;
14 |
15 | import java.io.IOException;
16 | import java.net.URI;
17 |
18 | import org.sonatype.nexus.testsuite.testsupport.FormatClientSupport;
19 |
20 | import org.apache.http.HttpEntity;
21 | import org.apache.http.HttpResponse;
22 | import org.apache.http.client.methods.HttpGet;
23 | import org.apache.http.client.methods.HttpPut;
24 | import org.apache.http.client.protocol.HttpClientContext;
25 | import org.apache.http.impl.client.CloseableHttpClient;
26 |
27 | /**
28 | * A simple test client for Helm repositories.
29 | *
30 | * @since 1.0.0
31 | */
32 | public class HelmClient
33 | extends FormatClientSupport
34 | {
35 | public HelmClient(final CloseableHttpClient httpClient,
36 | final HttpClientContext httpClientContext,
37 | final URI repositoryBaseUri)
38 | {
39 | super(httpClient, httpClientContext, repositoryBaseUri);
40 | }
41 |
42 | public HttpResponse fetch(final String path, String contentType) throws IOException {
43 | HttpGet request = new HttpGet(resolve(path));
44 | request.addHeader("Content-Type", contentType);
45 | return execute(request);
46 | }
47 |
48 | public HttpResponse put(String path, HttpEntity entity) throws IOException {
49 | final URI resolve = resolve(path);
50 | final HttpPut put = new HttpPut(resolve);
51 | put.setEntity(entity);
52 | return execute(put);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/content/HelmClient.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.content;
14 |
15 | import java.io.IOException;
16 | import java.net.URI;
17 |
18 | import org.sonatype.nexus.content.testsupport.FormatClientSupport;
19 |
20 | import org.apache.http.HttpEntity;
21 | import org.apache.http.HttpResponse;
22 | import org.apache.http.client.methods.HttpGet;
23 | import org.apache.http.client.methods.HttpPut;
24 | import org.apache.http.client.protocol.HttpClientContext;
25 | import org.apache.http.impl.client.CloseableHttpClient;
26 |
27 | /**
28 | * A simple test client for Helm repositories.
29 | */
30 | public class HelmClient
31 | extends FormatClientSupport
32 | {
33 | public HelmClient(final CloseableHttpClient httpClient,
34 | final HttpClientContext httpClientContext,
35 | final URI repositoryBaseUri)
36 | {
37 | super(httpClient, httpClientContext, repositoryBaseUri);
38 | }
39 |
40 | public HttpResponse fetch(final String path, String contentType) throws IOException {
41 | HttpGet request = new HttpGet(resolve(path));
42 | request.addHeader("Content-Type", contentType);
43 | return execute(request);
44 | }
45 |
46 | public HttpResponse put(String path, HttpEntity entity) throws IOException {
47 | final URI resolve = resolve(path);
48 | final HttpPut put = new HttpPut(resolve);
49 | put.setEntity(entity);
50 | return execute(put);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/content/HelmContentHostedIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.content;
14 |
15 | import java.io.IOException;
16 | import java.nio.file.Path;
17 | import java.nio.file.Paths;
18 | import java.util.concurrent.TimeUnit;
19 |
20 | import org.sonatype.nexus.common.app.BaseUrlHolder;
21 | import org.sonatype.nexus.repository.Repository;
22 | import org.sonatype.nexus.repository.http.HttpStatus;
23 |
24 | import com.google.common.io.Files;
25 | import org.apache.http.HttpEntity;
26 | import org.apache.http.HttpResponse;
27 | import org.apache.http.entity.ByteArrayEntity;
28 | import org.junit.Before;
29 | import org.junit.Test;
30 |
31 | import static org.hamcrest.MatcherAssert.assertThat;
32 | import static org.hamcrest.Matchers.is;
33 | import static org.sonatype.nexus.content.testsupport.FormatClientSupport.bytes;
34 | import static org.sonatype.nexus.content.testsupport.FormatClientSupport.status;
35 |
36 | public class HelmContentHostedIT
37 | extends HelmContentITSupport
38 | {
39 | private HelmClient client;
40 |
41 | private Repository repository;
42 |
43 | @Before
44 | public void setup() throws Exception {
45 | BaseUrlHolder.set(this.nexusUrl.toString());
46 |
47 | repository = repos.createHelmHosted("helm-hosted-test");
48 | client = helmClient(repository);
49 | uploadPackages(MONGO_PKG_FILE_NAME_600_TGZ, MONGO_PKG_FILE_NAME_728_TGZ);
50 | TimeUnit.SECONDS.sleep(2);
51 | }
52 |
53 | @Test
54 | public void fetchMetaData() throws Exception {
55 | HttpResponse httpResponse = client.fetch(YAML_FILE_NAME, CONTENT_TYPE_YAML);
56 |
57 | assertThat(status(httpResponse), is(HttpStatus.OK));
58 | }
59 |
60 | @Test
61 | public void fetchTgzPackageFile() throws Exception {
62 | HttpResponse httpResponse = client.fetch(MONGO_PKG_FILE_NAME_600_TGZ, CONTENT_TYPE_TGZ);
63 |
64 | assertThat(status(httpResponse), is(HttpStatus.OK));
65 | assertThat(bytes(httpResponse), is(Files.toByteArray(testData.resolveFile(MONGO_PKG_FILE_NAME_600_TGZ))));
66 | }
67 |
68 | private void uploadPackages(String... names) throws IOException {
69 | for (String name : names) {
70 | client.put(name, fileToHttpEntity(name));
71 | }
72 | }
73 |
74 | private Path getFilePathByName(String fileName) {
75 | return Paths.get(testData.resolveFile(fileName).getAbsolutePath());
76 | }
77 |
78 | protected HttpEntity fileToHttpEntity(String name) throws IOException {
79 | return new ByteArrayEntity(java.nio.file.Files.readAllBytes(getFilePathByName(name)));
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/content/HelmContentITSupport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.content;
14 |
15 | import java.net.URL;
16 |
17 | import javax.annotation.Nonnull;
18 |
19 | import org.sonatype.nexus.content.testsupport.NexusITSupport;
20 | import org.sonatype.nexus.pax.exam.NexusPaxExamSupport;
21 | import org.sonatype.nexus.plugins.helm.internal.content.fixtures.RepositoryRuleHelm;
22 | import org.sonatype.nexus.repository.Repository;
23 |
24 | import org.junit.Rule;
25 | import org.ops4j.pax.exam.Configuration;
26 | import org.ops4j.pax.exam.Option;
27 |
28 | import static com.google.common.base.Preconditions.checkNotNull;
29 | import static java.lang.String.format;
30 | import static org.ops4j.pax.exam.CoreOptions.systemProperty;
31 |
32 | public class HelmContentITSupport
33 | extends NexusITSupport
34 | {
35 | public static final String MONGO_PKG_NAME = "mongodb";
36 |
37 | public static final String YAML_NAME = "index";
38 |
39 | public static final String MONGO_PKG_VERSION_600 = "6.0.0";
40 |
41 | public static final String MONGO_PKG_VERSION_728 = "7.2.8";
42 |
43 | public static final String TGZ_EXT = ".tgz";
44 |
45 | public static final String YAML_EXT = ".yaml";
46 |
47 | public static final String MONGO_PKG_FILE_NAME_600_TGZ = format("%s-%s%s",
48 | MONGO_PKG_NAME, MONGO_PKG_VERSION_600, TGZ_EXT);
49 |
50 | public static final String MONGO_PKG_FILE_NAME_728_TGZ = format("%s-%s%s",
51 | MONGO_PKG_NAME, MONGO_PKG_VERSION_728, TGZ_EXT);
52 |
53 | public static final String CONTENT_TYPE_TGZ = "application/x-tgz";
54 |
55 | public static final String CONTENT_TYPE_YAML = "text/x-yaml";
56 |
57 | public static final String YAML_FILE_NAME = String.format("%s%s", YAML_NAME, YAML_EXT);
58 |
59 | @Configuration
60 | public static Option[] configureNexus() {
61 | return NexusPaxExamSupport.options(
62 | NexusITSupport.configureNexusBase(),
63 | nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-helm"),
64 | systemProperty("nexus-exclude-features").value("nexus-cma-community, nexus-community-feature")
65 | );
66 | }
67 |
68 | @Rule
69 | public RepositoryRuleHelm repos = new RepositoryRuleHelm(() -> repositoryManager);
70 |
71 | public HelmContentITSupport() {
72 | testData.addDirectory(NexusPaxExamSupport.resolveBaseFile("target/test-classes/helm"));
73 | }
74 |
75 | @Nonnull
76 | protected URL repositoryBaseUrl(Repository repository) {
77 | return resolveUrl(this.nexusUrl, "/repository/" + repository.getName() + "/");
78 | }
79 |
80 | @Nonnull
81 | protected HelmClient helmClient(final Repository repository) throws Exception {
82 | checkNotNull(repository);
83 | final URL repositoryUrl = repositoryBaseUrl(repository);
84 |
85 | return new HelmClient(
86 | clientBuilder(repositoryUrl).build(),
87 | clientContext(),
88 | repositoryUrl.toURI()
89 | );
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/content/HelmContentProxyIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.content;
14 |
15 | import org.sonatype.goodies.httpfixture.server.fluent.Server;
16 | import org.sonatype.nexus.common.app.BaseUrlHolder;
17 | import org.sonatype.nexus.repository.Repository;
18 | import org.sonatype.nexus.repository.http.HttpStatus;
19 |
20 | import com.google.common.io.Files;
21 | import org.apache.http.HttpResponse;
22 | import org.junit.After;
23 | import org.junit.Before;
24 | import org.junit.Test;
25 |
26 | import static org.hamcrest.MatcherAssert.assertThat;
27 | import static org.hamcrest.Matchers.is;
28 | import static org.sonatype.goodies.httpfixture.server.fluent.Behaviours.error;
29 | import static org.sonatype.goodies.httpfixture.server.fluent.Behaviours.file;
30 | import static org.sonatype.nexus.content.testsupport.FormatClientSupport.bytes;
31 | import static org.sonatype.nexus.content.testsupport.FormatClientSupport.status;
32 |
33 | public class HelmContentProxyIT
34 | extends HelmContentITSupport
35 | {
36 | private HelmClient client;
37 |
38 | private Repository repository;
39 |
40 | private Server server;
41 |
42 | @Before
43 | public void setup() throws Exception {
44 | BaseUrlHolder.set(this.nexusUrl.toString());
45 | server = Server.withPort(0)
46 | .serve("/*").withBehaviours(error(200))
47 | .serve("/" + MONGO_PKG_FILE_NAME_600_TGZ)
48 | .withBehaviours(file(testData.resolveFile(MONGO_PKG_FILE_NAME_600_TGZ)))
49 | .serve("/" + YAML_FILE_NAME).withBehaviours(file(testData.resolveFile(YAML_FILE_NAME)))
50 | .start();
51 | repository = repos.createHelmProxy("helm-proxy-test", server.getUrl().toExternalForm());
52 | client = helmClient(repository);
53 | }
54 |
55 | @After
56 | public void tearDown() throws Exception {
57 | server.stop();
58 | }
59 |
60 | @Test
61 | public void fetchMetaData() throws Exception {
62 | HttpResponse httpResponse = client.fetch(YAML_FILE_NAME, CONTENT_TYPE_YAML);
63 |
64 | assertThat(status(httpResponse), is(HttpStatus.OK));
65 | assertThat(bytes(httpResponse), is(Files.toByteArray(testData.resolveFile(YAML_FILE_NAME))));
66 | }
67 |
68 | @Test
69 | public void fetchTgzPackageFile() throws Exception {
70 | HttpResponse httpResponse = client.fetch(MONGO_PKG_FILE_NAME_600_TGZ, CONTENT_TYPE_TGZ);
71 |
72 | assertThat(status(httpResponse), is(HttpStatus.OK));
73 | assertThat(bytes(httpResponse), is(Files.toByteArray(testData.resolveFile(MONGO_PKG_FILE_NAME_600_TGZ))));
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/content/fixtures/HelmRepoRecipes.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.content.fixtures
14 |
15 | import javax.annotation.Nonnull
16 |
17 | import org.sonatype.nexus.repository.Repository
18 | import org.sonatype.nexus.repository.config.Configuration
19 | import org.sonatype.nexus.content.testsupport.fixtures.ConfigurationRecipes
20 |
21 | import groovy.transform.CompileStatic
22 |
23 | /**
24 | * Factory for Helm {@link Repository} {@link Configuration}
25 | */
26 | @CompileStatic
27 | trait HelmRepoRecipes
28 | extends ConfigurationRecipes
29 | {
30 | @Nonnull
31 | Repository createHelmProxy(final String name,
32 | final String remoteUrl)
33 | {
34 | createRepository(createProxy(name, 'helm-proxy', remoteUrl))
35 | }
36 |
37 | @Nonnull
38 | Repository createHelmHosted(final String name)
39 | {
40 | createRepository(createHosted(name, 'helm-hosted'))
41 | }
42 |
43 | abstract Repository createRepository(final Configuration configuration)
44 | }
45 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/content/fixtures/RepositoryRuleHelm.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.content.fixtures
14 |
15 | import javax.inject.Provider
16 |
17 | import org.sonatype.nexus.repository.manager.RepositoryManager
18 | import org.sonatype.nexus.content.testsupport.fixtures.RepositoryRule
19 |
20 | class RepositoryRuleHelm
21 | extends RepositoryRule
22 | implements HelmRepoRecipes
23 | {
24 | RepositoryRuleHelm(final Provider repositoryManagerProvider) {
25 | super(repositoryManagerProvider)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/fixtures/HelmRepoRecipes.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.fixtures
14 |
15 | import javax.annotation.Nonnull
16 |
17 | import org.sonatype.nexus.repository.Repository
18 | import org.sonatype.nexus.repository.config.Configuration
19 | import org.sonatype.nexus.testsuite.testsupport.fixtures.ConfigurationRecipes
20 |
21 | import groovy.transform.CompileStatic
22 |
23 | /**
24 | * Factory for Helm {@link Repository} {@link Configuration}
25 | */
26 | @CompileStatic
27 | trait HelmRepoRecipes
28 | extends ConfigurationRecipes
29 | {
30 | @Nonnull
31 | Repository createHelmProxy(final String name,
32 | final String remoteUrl)
33 | {
34 | createRepository(createProxy(name, 'helm-proxy', remoteUrl))
35 | }
36 |
37 | @Nonnull
38 | Repository createHelmHosted(final String name)
39 | {
40 | createRepository(createHosted(name, 'helm-hosted'))
41 | }
42 |
43 | abstract Repository createRepository(final Configuration configuration)
44 | }
45 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/java/org/sonatype/nexus/plugins/helm/internal/fixtures/RepositoryRuleHelm.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.nexus.plugins.helm.internal.fixtures
14 |
15 | import javax.inject.Provider
16 |
17 | import org.sonatype.nexus.repository.manager.RepositoryManager
18 | import org.sonatype.nexus.testsuite.testsupport.fixtures.RepositoryRule
19 |
20 | class RepositoryRuleHelm
21 | extends RepositoryRule
22 | implements HelmRepoRecipes
23 | {
24 | RepositoryRuleHelm(final Provider repositoryManagerProvider) {
25 | super(repositoryManagerProvider)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/resources/helm/index.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: '1.0'
2 | entries:
3 | mongodb:
4 | - appVersion: 4.0.10
5 | created: 2019-09-18T12:38:38.917Z
6 | description: NoSQL document-oriented database that stores JSON-like documents
7 | with dynamic schemas, simplifying the integration of data in content-driven
8 | applications.
9 | digest: f2c4dbe8cdd019f97eb9c1843a1748e60d94ef9142c3722121649455c6a21a80
10 | icon: https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png
11 | maintainers:
12 | - email: containers@bitnami.com
13 | name: Bitnami
14 | name: mongodb
15 | sources:
16 | - https://github.com/bitnami/bitnami-docker-mongodb
17 | urls:
18 | - mongodb-6.0.0.tgz
19 | version: 6.0.0
20 | - appVersion: 4.0.12
21 | created: 2019-09-18T10:35:13.855Z
22 | description: NoSQL document-oriented database that stores JSON-like documents
23 | with dynamic schemas, simplifying the integration of data in content-driven
24 | applications.
25 | digest: 5b5550f485c8b489006c8d519d6d6b0799928aaac45ffc9b527a8f9fbb2234a6
26 | icon: https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png
27 | maintainers:
28 | - email: containers@bitnami.com
29 | name: Bitnami
30 | name: mongodb
31 | sources:
32 | - https://github.com/bitnami/bitnami-docker-mongodb
33 | urls:
34 | - mongodb-7.2.8.tgz
35 | version: 7.2.8
36 | generated: 2019-09-18T12:38:50.332Z
37 |
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/resources/helm/mongodb-4.0.4.tgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonatype-nexus-community/nexus-repository-helm/e9178160b16f5500a1e91b21ee98423a96968f65/nexus-repository-helm-it/src/test/resources/helm/mongodb-4.0.4.tgz
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/resources/helm/mongodb-6.0.0.tgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonatype-nexus-community/nexus-repository-helm/e9178160b16f5500a1e91b21ee98423a96968f65/nexus-repository-helm-it/src/test/resources/helm/mongodb-6.0.0.tgz
--------------------------------------------------------------------------------
/nexus-repository-helm-it/src/test/resources/helm/mongodb-7.2.8.tgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonatype-nexus-community/nexus-repository-helm/e9178160b16f5500a1e91b21ee98423a96968f65/nexus-repository-helm-it/src/test/resources/helm/mongodb-7.2.8.tgz
--------------------------------------------------------------------------------
/nexus-repository-helm/src/main/java/org/sonatype/repository/helm/HelmAttributes.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sonatype Nexus (TM) Open Source Version
3 | * Copyright (c) 2018-present Sonatype, Inc.
4 | * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
5 | *
6 | * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
7 | * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
8 | *
9 | * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
10 | * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
11 | * Eclipse Foundation. All other trademarks are the property of their respective owners.
12 | */
13 | package org.sonatype.repository.helm;
14 |
15 | import java.util.EnumMap;
16 | import java.util.List;
17 | import java.util.Map;
18 | import java.util.Optional;
19 |
20 | import org.sonatype.nexus.common.collect.NestedAttributesMap;
21 | import org.sonatype.repository.helm.internal.database.HelmProperties;
22 |
23 | /**
24 | * @since 1.0.0
25 | */
26 | public class HelmAttributes
27 | {
28 | private final Map attributesEnumMap;
29 |
30 | public HelmAttributes() {
31 | attributesEnumMap = new EnumMap<>(HelmProperties.class);
32 | }
33 |
34 | public HelmAttributes(final Map attributesMap) {
35 | attributesEnumMap = new EnumMap<>(HelmProperties.class);
36 | attributesMap.forEach((key, value) -> {
37 | Optional propertyOpt = HelmProperties.findByPropertyName(key);
38 | if (value != null && propertyOpt.isPresent()) {
39 | attributesEnumMap.put(propertyOpt.get(), value);
40 | }
41 | });
42 | }
43 |
44 | public void populate(final NestedAttributesMap attributesMap) {
45 | attributesEnumMap.forEach((helmProperties, o) -> attributesMap.set(helmProperties.getPropertyName(), o));
46 | }
47 |
48 | public String getName() {
49 | return getValue(HelmProperties.NAME, String.class);
50 | }
51 |
52 | public String getVersion() {
53 | return getValue(HelmProperties.VERSION, String.class);
54 | }
55 |
56 | public String getAppVersion() {
57 | return getValue(HelmProperties.APP_VERSION, String.class);
58 | }
59 |
60 | public String getDescription() {
61 | return getValue(HelmProperties.DESCRIPTION, String.class);
62 | }
63 |
64 | public String getIcon() {
65 | return getValue(HelmProperties.ICON, String.class);
66 | }
67 |
68 | public String getEngine() {
69 | return getValue(HelmProperties.ENGINE, String.class);
70 | }
71 |
72 | public List getKeywords() {
73 | return getValue(HelmProperties.KEYWORDS, List.class);
74 | }
75 |
76 |
77 | public List