<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2015-2022 Micro Focus or one of its affiliates.

    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.

-->
<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>com.github.autoscaler</groupId>
    <artifactId>autoscale-kubernetes-container</artifactId>
    <packaging>pom</packaging>

    <parent>
        <groupId>com.github.autoscaler</groupId>
        <artifactId>autoscale-aggregator</artifactId>
        <version>1.9.1-797</version>
    </parent>

    <properties>
        <caf.autoscale-scaler.impl>autoscale-scaler-kubernetes</caf.autoscale-scaler.impl>
        <caf.autoscale-source.impl>autoscale-source-kubernetes</caf.autoscale-source.impl>
        <caf.autoscale-workload.impl>autoscale-workload-rabbit</caf.autoscale-workload.impl>
        <caf.config.impl>config-file</caf.config.impl>
        <caf.codec.impl>codec-json</caf.codec.impl>
        <caf.worker-store.impl>worker-store-cs</caf.worker-store.impl>
        <caf.worker-queue.impl>worker-queue-rabbit</caf.worker-queue.impl>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.github.autoscaler</groupId>
            <artifactId>autoscale-email-alert-dispatcher</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.cafapi</groupId>
            <artifactId>caf-api</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.cafapi.config</groupId>
            <artifactId>${caf.config.impl}</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.cafapi.decoder</groupId>
            <artifactId>decoder-js</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.autoscaler</groupId>
            <artifactId>autoscale-core</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.autoscaler</groupId>
            <artifactId>autoscale-kubernetes-shared</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.autoscaler</groupId>
            <artifactId>${caf.autoscale-source.impl}</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.autoscaler</groupId>
            <artifactId>${caf.autoscale-scaler.impl}</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.autoscaler</groupId>
            <artifactId>${caf.autoscale-workload.impl}</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.github.cafapi.codec</groupId>
            <artifactId>${caf.codec.impl}</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.kubernetes</groupId>
            <artifactId>client-java-extended</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${fabric8.docker.maven.version}</version>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>build</goal>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>upload-docker-container</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <watchInterval>500</watchInterval>
                    <logDate>default</logDate>
                    <verbose>true</verbose>
                    <images>
                        <image>
                            <alias>autoscale-container</alias>
                            <name>${dockerAutoscalerOrg}autoscale-kubernetes-rabbit${dockerProjectVersion}</name>
                            <build>
                                <from>${dockerHubPublic}/cafapi/opensuse-jre11:3</from>
                                <cmd>
                                    <exec>
                                        <args>/maven/scaler.sh</args>
                                    </exec>
                                </cmd>
                                <healthCheck>
                                    <cmd>curl --fail http://localhost:8081/healthcheck || exit 1</cmd>
                                </healthCheck>
                                <assembly>
                                    <mode>tar</mode>
                                    <inline>
                                        <fileSets>
                                            <fileSet>
                                                <includes>
                                                    <include>*.sh</include>
                                                </includes>
                                                <fileMode>0755</fileMode>
                                            </fileSet>
                                            <fileSet>
                                                <includes>
                                                    <include>*.yaml</include>
                                                </includes>
                                            </fileSet>
                                            <fileSet>
                                                <directory>src/main/config</directory>
                                                <outputDirectory>config</outputDirectory>
                                            </fileSet>
                                        </fileSets>
                                        <dependencySets>
                                            <dependencySet>
                                                <useProjectArtifact>false</useProjectArtifact>
                                                <scope>runtime</scope>
                                            </dependencySet>
                                        </dependencySets>
                                    </inline>
                                </assembly>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>

            <!-- Exclude the test and example configuration files when checking license headers -->
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
