Skip to content

Commit

Permalink
#3, prepare kubectl krew support
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Aug 1, 2022
1 parent 9b23a6f commit 20852e5
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 8 deletions.
123 changes: 119 additions & 4 deletions bundlebee-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>bundlebee</artifactId>
<groupId>io.yupiik</groupId>
Expand All @@ -31,7 +32,7 @@
<dependency> <!-- todo: replace it by something lighter without the mapping feature? -->
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.29</version>
<version>1.30</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -141,11 +142,12 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.yupiik.bundlebee.core.BundleBee</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/beans.xml</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.properties.OpenWebBeansPropertiesTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.properties.OpenWebBeansPropertiesTransformer"/>
</transformers>
<filters>
<filter>
Expand Down Expand Up @@ -173,7 +175,10 @@
<profiles>
<profile>
<id>native</id>

<build>
<finalName>${project.artifactId}</finalName>

<plugins>
<plugin> <!-- mvn package -Pnative -DskipTests -->
<groupId>org.apache.geronimo.arthur</groupId>
Expand All @@ -191,6 +196,116 @@
<main>io.yupiik.bundlebee.core.BundleBee</main>
</configuration>
</plugin>

<!-- enable to work with krew kubectl plugin manager (zip + manifest filtering) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>kubectl-bundlebee-zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>${project.basedir}/src/main/assembly/kubectl-bundlebee.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<executions>
<execution>
<id>krew-sha256</id>
<phase>package</phase>
<goals>
<goal>files</goal>
</goals>
<configuration>
<csvSummary>false</csvSummary>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>${project.build.finalName}-kubectl-bundlebee.zip</include>
</includes>
</fileSet>
</fileSets>
<algorithms>
<algorithm>SHA-256</algorithm>
</algorithms>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.honton.chas</groupId>
<artifactId>readfiles-maven-plugin</artifactId>
<executions>
<execution>
<id>read-kubectl-bundlebee-sha256</id>
<phase>package</phase>
<goals>
<goal>readfiles</goal>
</goals>
<configuration>
<files>
<file>${project.build.directory}/${project.build.finalName}-kubectl-bundlebee.zip.sha256</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>copy-krew-manifest</id>
<phase>verify</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/target/krew</outputDirectory>
<resources>
<resource>
<directory>src/main/krew</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-krew</id>
<phase>verify</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.basedir}/target/krew/manifest.yaml</file>
<type>yaml</type>
<classifier>krew.manifest</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
35 changes: 35 additions & 0 deletions bundlebee-core/src/main/assembly/kubectl-bundlebee.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021-2022 - Yupiik SAS - https://www.yupiik.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<assembly xmlns="https://maven.apache.org/ASSEMBLY/2.1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
https://maven.apache.org/ASSEMBLY/2.1.1
https://maven.apache.org/xsd/assembly-component-2.1.1.xsd">
<id>kubectl-bundlebee</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>${project.build.directory}/${project.artifactId}</source>
<destName>kubectl-bundlebee</destName>
</file>
</files>
</assembly>
40 changes: 40 additions & 0 deletions bundlebee-core/src/main/krew/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Copyright (c) 2021-2022 - Yupiik SAS - https://www.yupiik.com
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: bundlebee
spec:
version: "${project.version}"
homepage: https://www.yupiik.io/bundlebee/
shortDescription: "Simple Kubernetes Package Manager"
description: |
Handles Kubernetes recipes to simplify application installation.
You can learn more at https://www.yupiik.io/bundlebee/ and https://github.com/yupiik/bundlebee.
platforms:
- selector:
matchExpressions:
- key: "os"
operator: "In"
values:
- linux
uri: https://repo.maven.apache.org/maven2/io/yupiik/bundlebee-core/${project.version}/bundlebee-core-${project.version}-kubectl-bundlebee.zip
sha256: ${bundlebee-core-kubectl-bundlebee.zip.sha256}
bin: kubectl-bundlebee
files:
- from: "kubectl-bundlebee"
to: "./kubectl-bundlebee"
25 changes: 21 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.yupiik</groupId>
Expand Down Expand Up @@ -175,7 +176,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
Expand Down Expand Up @@ -207,7 +208,8 @@
<bundlebee.kube.api>https://kubernetes.bundlebee.yupiik.test</bundlebee.kube.api>
<bundlebee.kube.validateSSL>false</bundlebee.kube.validateSSL>
<m2.location>${m2.location}</m2.location>
<jdk.internal.httpclient.disableHostnameVerification>true</jdk.internal.httpclient.disableHostnameVerification>
<jdk.internal.httpclient.disableHostnameVerification>true
</jdk.internal.httpclient.disableHostnameVerification>
<kubeconfig>explicit</kubeconfig>
<java.util.logging.manager>io.yupiik.logging.jul.YupiikLogManager</java.util.logging.manager>
<org.talend.__shade__.io.netty.noUnsafe>true</org.talend.__shade__.io.netty.noUnsafe>
Expand Down Expand Up @@ -270,6 +272,21 @@ under the License.
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.10</version>
</plugin>
<plugin>
<groupId>org.honton.chas</groupId>
<artifactId>readfiles-maven-plugin</artifactId>
<version>0.0.1</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand Down Expand Up @@ -338,7 +355,7 @@ under the License.
<executions>
<execution>
<id>audit-dependencies</id>
<phase />
<phase/>
<goals>
<goal>audit</goal>
</goals>
Expand Down

0 comments on commit 20852e5

Please sign in to comment.