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

[IF-990] Add to template configuration to disable cyclic rebuilds #54

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ terraform {
required_providers {
imagefactory = {
source = "nordcloud/imagefactory"
version = "1.8.0"
version = "1.8.1"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion docs/resources/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ Optional:
- `azure` (Block List) (see [below for nested schema](#nestedblock--config--azure))
- `build_components` (Block List) (see [below for nested schema](#nestedblock--config--build_components))
- `cloud_account_ids` (List of String)
- `disable_cyclical_rebuilds` (Boolean) Disable cyclical rebuilds. Cyclical rebuilds are rebuilds that are triggered automatically by ImageFactory when the source image is updated or when there are security updates available for the packages installed in the image. If cyclical rebuilds are disabled, the template will not be rebuilt automatically and the user will have to trigger the rebuild manually. Default value is set to false.
- `exoscale` (Block List) (see [below for nested schema](#nestedblock--config--exoscale))
- `notifications` (Block List) (see [below for nested schema](#nestedblock--config--notifications))
- `scope` (String)
Expand All @@ -272,7 +273,7 @@ Optional:

Optional:

- `additional_ebs_volumes` (Block List) (see [below for nested schema](#nestedblock--config--aws--additional_ebs_volumes))
- `additional_ebs_volumes` (Block List, Max: 10) (see [below for nested schema](#nestedblock--config--aws--additional_ebs_volumes))
- `custom_image_name` (String)
- `region` (String)

Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ terraform {
required_providers {
imagefactory = {
source = "nordcloud/imagefactory"
version = "1.8.0"
version = "1.8.1"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions imagefactory/imagetemplate/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ var templateConfigResource = &schema.Resource{
ValidateFunc: validation.StringInSlice(validScopes, false),
Default: graphql.ScopePUBLIC,
},
"disable_cyclical_rebuilds": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "Disable cyclical rebuilds. " +
"Cyclical rebuilds are rebuilds that are triggered automatically by ImageFactory when the source image is updated or " +
"when there are security updates available for the packages installed in the image. If cyclical rebuilds are disabled, " +
"the template will not be rebuilt automatically and the user will have to trigger the rebuild manually. " +
"Default value is set to false.",
},
},
}

Expand Down
5 changes: 5 additions & 0 deletions imagefactory/imagetemplate/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ func expandTemplateConfig(in []interface{}) (*graphql.NewTemplateConfig, error)
templateConfig.CloudAccountIds = &cloudAccountIDs
}

if m["disable_cyclical_rebuilds"] != nil {
disableCyclicalRebuilds := graphql.Boolean(m["disable_cyclical_rebuilds"].(bool))
templateConfig.DisableCyclicalRebuilds = &disableCyclicalRebuilds
}

return &templateConfig, nil
}

Expand Down
39 changes: 21 additions & 18 deletions pkg/graphql/graphql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions pkg/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ https://docs.imagefactory.nordcloudapp.com/onboarding
"""
input AccountCredentials {
aws: AWSCredentials
aws: AWSCredentials
gcp: GCPCredentials
aws: AWSCredentials
gcp: GCPCredentials
azure: AzureCredentials
exoscale: ExoscaleCredentials
gcp: GCPCredentials
Expand Down Expand Up @@ -608,7 +604,7 @@ type CustomerStats {
}


# Copyright 2021-2022 Nordcloud Oy or its affiliates. All Rights Reserved.
# Copyright 2021-2023 Nordcloud Oy or its affiliates. All Rights Reserved.

"""
Distribution defines the cloud image that can be created by the ImageFactory.
Expand All @@ -632,6 +628,7 @@ type Distribution {
osLatest: Boolean
osEolDate: String
complianceScore: ComplianceScore
deprecated: Boolean
}

type ComplianceScore {
Expand Down Expand Up @@ -1021,6 +1018,7 @@ type TemplateConfig {
tags: [Tag!]
notifications: [Notification!]
scope: Scope
disableCyclicalRebuilds: Boolean
aws: TemplateAWSConfig
azure: TemplateAZUREConfig
exoscale: TemplateExoscaleConfig
Expand Down Expand Up @@ -1115,7 +1113,7 @@ input NewTemplateAWSConfig {
customImageName: String

"""
additionalEbsVolumes defines extra EBS volumes attached to the AMI image.
`additionalEbsVolumes` defines extra EBS volumes attached to the AMI image with a limit of 10.

"""
additionalEbsVolumes: [NewAdditionalEBSVolumes!]
Expand Down Expand Up @@ -1181,6 +1179,15 @@ input NewTemplateConfig {
cloudAccountIds defines a list of Cloud Account IDs to which we will distribute the image.
"""
cloudAccountIds: [String]

"""
disableCyclicalRebuilds defines if cyclical rebuilds are disabled for the template

Cyclical rebuilds are rebuilds that are triggered automatically by ImageFactory when the source image is updated or
when there are security updates available for the packages installed in the image. If cyclical rebuilds are disabled,
the template will not be rebuilt automatically and the user will have to trigger the rebuild manually.
"""
disableCyclicalRebuilds: Boolean
}

input NewTemplate {
Expand Down
Loading