apigee / apigee-deploy-maven-plugin

Apache License 2.0
80 stars 169 forks source link

Installation failed. #192

Closed simantstha closed 2 years ago

simantstha commented 2 years ago

image

ssvaidyanathan commented 2 years ago

You are using the wrong version if you are using Apigee X or hybrid. The version for Apigee X or hybrid is 2.x Please follow the README

simantstha commented 2 years ago

I did change the version but still getting the same problem. Also does it work on apigeex which is on apigee.google.com. As, apigee does not offer the old trial version. if it does work then what should be the organization for that. image

ssvaidyanathan commented 2 years ago

The error message clearly states the issue - "Service Account file or bearer token missing"

Yes the version 2.x works with Apigee X. If you login to your Apigee setup (apigee.google.com), it will show you the org name on the top.

For the issue you saw, you will need to setup a service account in GCP IAM with Apigee Organization Admin role, download the JSON Key and then pass the path of the file in the plugin.

Or else.. install gcloud SDK on your laptop and then run gcloud auth login from your terminal. Once logged in, you can generate the token on your terminal using gcloud auth print-access-token and then pass that to the plugin with the -Dbearer=$token argument

simantstha commented 2 years ago

I did install gcloud sdk and was able to generate token. but i was not sure what was the full command to execute -Dbearer=$token

ssvaidyanathan commented 2 years ago

just run your mvn command and for the bearer argument just run -Dbearer=$(gcloud auth print-access-token)

simantstha commented 2 years ago

I got this after i did previous step image

ssvaidyanathan commented 2 years ago

@simantstha - The error is very clear. It says the environment is not found which means you have a different name for your Apigee environment but the Maven configuration is using "test" I would appreciate you investigate a little deeper before reaching out

simantstha commented 2 years ago

Sorry for this was i was meaning to post this. Also is it possible to make proxy using a yaml file? image

ssvaidyanathan commented 2 years ago

Can you share the pom.xml and shared-pom.xml you are using? You need to update the config to point to your Apigee instance. Also can you share the Apigee org and env details so that I can help you?

No - this plugin does not support yaml

simantstha commented 2 years ago

Org: testdrupal2022 Env: eval POM.XML

4.0.0 org.sonatype.oss oss-parent 7 io.apigee.build-tools.enterprise4g apigee-edge-maven-plugin maven-plugin 2.3.1 apigee-edge-maven-plugin maven mojo http://maven.apache.org Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 repo Copyright (C) 2014 Apigee Corporation 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. git@github.com:apigee/apigee-deploy-maven-plugin.git scm:git:https://github.com/apigee/apigee-deploy-maven-plugin.git scm:git:ssh://git@github.com/apigee/apigee-deploy-maven-plugin.git apigee-edge-maven-plugin-1.0.0 ssvaidyanathan Sai Saran Vaidyanathan msadasivam Madhan Sadasivam 1.8 1.8 UTF-8 5.3.18 5.6.1 2.17.1 3.1.0 3.5 ${basedir}/src/main/java log4j.xml org.apache.maven.plugins maven-javadoc-plugin 2.10.2 attach-javadocs jar -Xdoclint:none 8 org.apache.maven.plugins maven-plugin-plugin 3.5 apigee-enterprise true mojo-descriptor descriptor help-goal helpmojo org.apache.maven maven-plugin-api 2.0 org.apache.maven maven-plugin-api ${maven.version} org.apache.maven maven-core ${maven.version} provided org.apache.maven.plugin-tools maven-plugin-annotations ${maven.api.version} provided com.google.http-client google-http-client 1.28.0 com.google.http-client google-http-client-jackson2 1.28.0 com.google.http-client google-http-client-gson 1.28.0 com.google.http-client google-http-client-apache 2.0.0 org.apache.logging.log4j log4j-api ${log4j.version} org.apache.logging.log4j log4j-core ${log4j.version} commons-logging commons-logging 1.1.1 provided org.apache.commons commons-lang3 3.1 com.google.code.gson gson 2.2.2 compile xalan xalan 2.7.1 org.eclipse.jgit org.eclipse.jgit 3.3.2.201404171909-r org.apache.axis2 axis2-kernel 1.3 jar compile jakarta-httpcore-niossl httpcomponents-httpcore httpcore org.apache.httpcomponents org.apache.httpcomponents httpcore-niossl org.apache.httpcomponents httpcore-nio woden org.apache.woden org.apache.axis2 axis2-metadata 1.3 jar compile woden org.apache.woden log4j log4j junit junit 4.11 test org.springframework spring-core ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-web ${spring.version} org.springframework.security spring-security-crypto ${spring.security.version} cglib cglib 2.2.2 com.auth0 java-jwt 3.1.0 com.google.auth google-auth-library-oauth2-http 0.18.0 default true ${org} ${env} ${username} ${password} true release-sign-artifacts performRelease true ${org} ${env} ${username} ${password} true org.apache.maven.plugins maven-source-plugin attach-sources jar org.apache.maven.plugins maven-javadoc-plugin attach-javadocs jar 8 org.apache.maven.plugins maven-gpg-plugin 1.4 sign-artifacts verify sign

Shared POM

<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">

4.0.0
<groupId>apigee</groupId>
<artifactId>parent-pom</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <name>Maven Plugin Repository</name>
        <url>https://repo1.maven.org/maven2</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <updatePolicy>never</updatePolicy>
        </releases>
    </pluginRepository>
</pluginRepositories>
<properties>
        <main.basedir>${project.basedir}</main.basedir>
</properties>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.5</version>
        </plugin>

        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <overwrite>true</overwrite>
                        <encoding>UTF-8</encoding>
                         <echo message="basedir parent : ${basedir}"/>
                        <outputDirectory>${basedir}/target/apiproxy</outputDirectory>
                        <resources>
                            <resource>
                                <directory>apiproxy</directory>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>io.apigee.build-tools.enterprise4g</groupId>
            <artifactId>apigee-edge-maven-plugin</artifactId>
            <version>2.3.1</version>
            <executions>
                <execution>
                    <id>configure-bundle</id>
                    <phase>package</phase>
                    <goals>
                        <goal>configure</goal>
                    </goals>
                </execution>
                <execution>
                    <id>deploy-bundle</id>
                    <phase>install</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
test test https://apigee.googleapis.com v1 ${org} ${env} oauth ${bearer} ${file} override ${googleTokenEmail} prod prod https://apigee.googleapis.com v1 ${org} ${env} oauth ${bearer} ${file} override ${googleTokenEmail}

ssvaidyanathan commented 2 years ago

I think you have the wrong pom pasted here

Follow these steps

1) Download this repo - https://github.com/apigee/apigee-deploy-maven-plugin/archive/refs/heads/hybrid.zip 2) Navigate to the samples/mockapi-recommended/src/gateway/Mock-v1 directory in your terminal 3) Execute the following command in your terminal mvn clean install -Ptest -Dorg=testdrupal2022 -Denv=eval -Dbearer=$(gcloud auth print-access-token) 4) Once the above executes successfully, you should see a Mock-v1 proxy deployed to Apigee. Check in the Apigee console. 5) Now using this template, you can deploy other Apigee proxies

simantstha commented 2 years ago

It has now throwing me 401 unauthorized access. Last time it did not. Can you see if i am doing initial steps right. image image

ssvaidyanathan commented 2 years ago

You have a $ sign in the front of the token Either remove that or else use -Dbearer=$(gcloud auth print-access-token)

simantstha commented 2 years ago

It worked thank you so much.