Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cloudbuild.yaml include a different cloud builder configuration

My project is split into gitmodules like so:

/ +
  |
  +-module_1
  |  |
  |  +- cloudbuild.yaml 
  |  +- src/
  |  +-.git/
  | 
  +-module_2
  |  |
  |  +- cloudbuild.yaml 
  |  +- src/
  |  +-.git/
  | 
  +- .git/
  +- .gitmodules
  +- cloudbuild.yaml

I'm trying to build submodules from parent repository, but cloudbuild has a problem with that, as it does not fetch gitmodules by itsself. So when I reference module_1/cloudbuild.yaml as a cloudbuild configuration the build fails because this file does not exist. I'm thinking about possilbe workarounds and i'd like to ask if the following is possible:

  1. referencing /cloudbuild.yaml as a build config
  2. adding a step to fetch gitmodules in cloudbuild.yaml
  3. Run a different cloudbuild file

The result should look something like:

steps:
  - name: 'gcr.io/$PROJECT_ID/git'
    args: ['submodule', 'update', '--init']
  - name: 'some kind of command that runs cloudbuild.yaml`
    args: ['module_1/cloudbuild.yaml']

Disclaimer I'm aware that I can just place all the cloudbuild configs inside the root repository, but I'd like the modules to be as much self-governing as possible

like image 243
Ben Avatar asked Aug 11 '18 20:08

Ben


People also ask

Which is the best file format to define cloud build structure?

You can write the build config file using the YAML or the JSON syntax. If you submit build requests using third-party http tools such as curl, use the JSON syntax. Note: If you're using VS Code or IntelliJ IDEs, you can use Cloud Code to author your YAML config files.

How do you configure cloud build to rebuild your image?

How do you configure Cloud Build to rebuild your image when a change is made to the source code? Add a Cloud Build trigger, and set it to fire on commit to associate repository. Add a Cloud Build function, and set it to fire on commit to associate repository.


1 Answers

I don't think what you want is possible. I don't think this part can work: - name: 'some kind of command that runs cloudbuild.yaml'

The best thing might be simply filing a feature request with our issue tracker that will allow you to reference "module_1/cloudbuild.yaml" directly as a configuration.

like image 150
Ying Li Avatar answered Oct 19 '22 23:10

Ying Li