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

Azure Functions Runtime 2.0.11946-alpha [breaking] #122

Closed
pragnagopa opened this issue Jul 11, 2018 · 3 comments
Closed

Azure Functions Runtime 2.0.11946-alpha [breaking] #122

pragnagopa opened this issue Jul 11, 2018 · 3 comments

Comments

@pragnagopa
Copy link
Member

pragnagopa commented Jul 11, 2018

Azure Functions Runtime v2.0.11946-alpha will be deployed by July 30th 2018, that uses the latest version of Azure Java Functions Library v1.0.0-beta-5 which has breaking changes that affect HttpTrigger Java functions. Please see release notes https://github.com/Azure/azure-functions-java-library/releases/tag/v1.0.0-beta-5 for more details

  • Here is the sample code for HttpTrigger using the updated API
package $package;

import java.util.*;
import com.microsoft.azure.functions.annotation.*;
import com.microsoft.azure.functions.*;

/**
 * Azure Functions with HTTP Trigger.
 */
public class Function {
    /**
     * This function listens at endpoint "/api/HttpTrigger-Java". Two ways to invoke it using "curl" command in bash:
     * 1. curl -d "HTTP Body" {your host}/api/HttpTrigger-Java
     * 2. curl {your host}/api/HttpTrigger-Java?name=HTTP%20Query
     */
    @FunctionName("HttpTrigger-Java")
    public HttpResponseMessage HttpTriggerJava(
            @HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
            final ExecutionContext context) {
        context.getLogger().info("Java HTTP trigger processed a request.");

        // Parse query parameter
        String query = request.getQueryParameters().get("name");
        String name = request.getBody().orElse(query);

        if (name == null) {
            return request.createResponseBuilder(HttpStatus.BAD_REQUEST).body("Please pass a name on the query string or in the request body").build();
        } else {
            return request.createResponseBuilder(HttpStatus.OK).body("Hello, " + name).build();
        }
    }
}

Note:
We are working on publishing updated azure-functions-maven-plugin and azure-functions-archetype to sonatype staging repo and this announcement will be updated with instructions on how to use the plugin from staging repo

Please use Azure/app-service-announcements-discussions#57 for discussions related to this release.

@Azure Azure locked as resolved and limited conversation to collaborators Jul 11, 2018
@pragnagopa
Copy link
Member Author

azure-functions-archetype and azure-functions-maven-plugin are now published to sonatype https://oss.sonatype.org/content/repositories/commicrosoftazure-2475/

Using Maven plugin from staging repository:

  • Delete following from maven local cache
    • azure-functions-maven-plugin
    • azure-maven-plugins-pom
    • azure-maven-plugin-lib
    • azure-maven-plugins
    • azure-functions-archetype
  • Add following profile to your settings.xml (In windows, maven user directory is under C:\Users\user\ .m2). Add settings.xml if you do not have one already
 <profiles>
    <profile>
      <id>archetype</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>archetype</id>
          <url>https://oss.sonatype.org/content/repositories/commicrosoftazure-2475/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
  • Run following command to create a function app with the azure-functions-library v1.0.0-beat-5
mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-functions-archetype -DarchetypeVersion=1.12
  • Add following in pom.xml to get the latest azure-function-maven plugin
 <pluginRepositories>
        <pluginRepository>
            <id>commicrosoftazure-2475</id>
            <name>commicrosoftazure-2475</name>
            <url>https://oss.sonatype.org/content/repositories/commicrosoftazure-2475/</url>
        </pluginRepository>
    </pluginRepositories>

@pragnagopa pragnagopa changed the title Azure Functions Runtime x Preview [breaking] Azure Functions Runtime 2.0.11942-alpha [breaking] Jul 24, 2018
@pragnagopa
Copy link
Member Author

We have the started release process for the functions runtime. Current ETA is end of this week.
To avoid impact, you can pin your Function App to the current version of the runtime now by updating the app setting FUNCTIONS_EXTENSION_VERSION to 2.0.11933-alpha. Once the new version is released, you will not be automatically upgraded and will have the ability to test your code with the new version, which we recommend you do in a different Function App.

@pragnagopa pragnagopa changed the title Azure Functions Runtime 2.0.11942-alpha [breaking] Azure Functions Runtime 2.0.11946-alpha [breaking] Jul 25, 2018
@pragnagopa
Copy link
Member Author

Release is now complete. CLI version 2.0.1-beta.34 is published.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant