Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-1895 Created action to release on tag. #49

Merged
merged 3 commits into from
Jul 30, 2024
Merged

CP-1895 Created action to release on tag. #49

merged 3 commits into from
Jul 30, 2024

Conversation

joaomper-TE
Copy link
Collaborator

Tested a slightly different approach in my fork, uploading the packages to Github Packages. The end result can be seen here:

image

Still missing:

@joaomper-TE joaomper-TE requested a review from a team July 18, 2024 15:38
@joaomper-TE
Copy link
Collaborator Author

joaomper-TE commented Jul 18, 2024

I was then able to add the GithubPackage as a repo to gradle, and with this code I was able to call the api:

package org.example;

import java.util.List;

import com.thousandeyes.sdk.client.*;
import com.thousandeyes.sdk.usage.UsageApi;



public class Main {
    public static void main(String[] args) throws ApiException {

        ApiClient defaultClient = NativeApiClient
                .builder()
                .baseUri("https://api.stg.thousandeyes.com")
                .bearerToken("<token>")
                .build();

        UsageApi apiInstance = new UsageApi(defaultClient);
        System.out.println(apiInstance.getUsage("85486", List.of()));

    }
}

however, 2 things that I noticed and will change in the generator regarding the READMEs:

1- We also need to import the Client + NativeClient, not only the com.thousandeyes.sdk:usage:version. Not sure why actually, since usage declares them as an implementation dependency:

dependencies {
    implementation project(":core:configuration")
    implementation project(":core:client")

and in the README we tell users that they simply need to install 1 package.

2- The example mentions a Configuration object that does not exist and may confuse clients

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure clients using the `defaultClient` object, such as
        // overriding the host and port, timeout, etc.
        QuotasApi apiInstance = new QuotasApi(defaultClient);

build.gradle Outdated
Comment on lines 101 to 103
id = 'api-team'
name = 'ThousandEyes API Team'
email = 'api-team@thousandeyes.com'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure if we should "expose" this info, maybe something to confirm with the Cisco team that is handling this process.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is mandatory to publish to Maven. But I confirmed with Natali if these should be our info or Cisco user/email, waiting on them to give an answer!

def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications.mavenJava
Copy link
Collaborator Author

@joaomper-TE joaomper-TE Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

@joaomper-TE joaomper-TE Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, and because I spent a lot of time banging my head around this, if the ORG_GRADLE_PROJECT_signingKeyId is not the short version of the key or if the private key is not in a specific format we get an error "> Could not read PGP secret key"

To export the private key correctly, we should use

gpg --armor --export-secret-keys <keyId>  \
    | awk 'NR == 1 { print "ORG_GRADLE_PROJECT_signingKey=" } 1' ORS='\\n'

}

signing {
def signingKeyId = findProperty("signingKeyId")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks for a property called ORG_GRADLE_PROJECT_signingKeyId. More on this.

@joaomper-TE joaomper-TE merged commit ce37fa9 into thousandeyes:main Jul 30, 2024
1 check passed
@joaomper-TE joaomper-TE deleted the CP-1895 branch July 30, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants