Skip to content

GoogleCloudPlatform/cloud-code-custom-samples-example

Repository files navigation

Example Custom Sample Repository

This repository is an example Custom Sample Repository that can be used with the Cloud Code plugins for VSCode and IntelliJ.

Apache Log4j Vulnerability (Log4j 2): this repository previously included a sample using a vulnerable version of Log4j 2. The sample was removed on December 15, 2021. We strongly advise customers to update their samples repositories. Visit the security advisory for details and remediation.


Usage

To see an example of how the Custom Sample feature of Cloud Code works, you can configure your IDE to recognize this repository and create applications based on the sample within. Follow the steps below to see this feature in action!

  1. Install Cloud Code for IntelliJ or VS Code

  2. Import the Custom Sample repo on IntelliJ or VS Code, using this repo's Git URL: https://github.com/GoogleCloudPlatform/cloud-code-custom-samples-example.git

You can create your own Custom Sample repo using this repository as a base.

  1. Clone this repository

  2. Create a new directory containing your own sample (or make changes to any of the samples)

  3. Make any necessary updates to the samples in the .cctemplate file

  4. Import your local, updated repository into Cloud Code


Contents

.cctemplate

The .cctemplate is a Sample Descriptor file that describes the contents of your repository so that Cloud Code knows where to look for your samples. It should look something like the following:

{
    "metadata": {
        "version": "1"
    },
    "templates": [
        {
            "path": "path/to/my/sample",
            "name": "My Sample",
            "description": "This sample helps you create something amazing!"
        },
        ...
    ]
}

There is an example .cctemplate file in this repository that you can review, and you can learn more about the Sample Descriptor schema here.

hello-world

A simple sample written in Go. You can see an entry for this sample in the .cctemplate file.

file-sync-example

An example application demonstrating skaffold's file sync, which is used by Cloud Code under the hood. Changes to a file are copied to the container without needing to rebuild or restart the corresponding pod. The original version of this sample is located in the skaffold examples repo.

kubernetes-custom-sample/nodejs

A Node.js sample with a frontend and backend service. This sample uses MongoDB as a database and runs on Kubernetes. You can see an entry for this sample in the .cctemplate file.


Sign up for user research

We want to hear your feedback!

The Cloud Code team is inviting our user community to sign-up to participate in Google User Experience Research.

If you’re invited to join a study, you may try out a new product or tell us what you think about the products you use every day. At this time, Google is only sending invitations for upcoming remote studies. Once a study is complete, you’ll receive a token of thanks for your participation such as a gift card or some Google swag.

Sign up using this link and answer a few questions about yourself, as this will help our research team match you to studies that are a great fit.


Contributing

Contributions welcome! Be sure to read our contributing guide and Code of Conduct.