github.com/paketo-buildpacks/libpak@v1.70.0/stack.go (about)

     1  /*
     2   * Copyright 2018-2020 the original author or authors.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *      https://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  package libpak
    18  
    19  const (
    20  	// BionicStackID is the ID for the Cloud Native Buildpacks bionic stack.
    21  	BionicStackID = "io.buildpacks.stacks.bionic"
    22  
    23  	// BionicTinyStackID is the ID for the Paketo Buildpacks bionic tiny stack.
    24  	BionicTinyStackID = "io.paketo.stacks.tiny"
    25  
    26  	// TinyStackID is the ID for the Paketo Buildpacks bionic tiny stack.
    27  	//
    28  	// Deprecated: use BionicTinyStackID instead
    29  	TinyStackID = "io.paketo.stacks.tiny"
    30  
    31  	// JammyStackID is the ID for the Cloud Native Buildpacks jammy stack.
    32  	JammyStackID = "io.buildpacks.stacks.jammy"
    33  
    34  	// JammyTinyStackID is the ID for the Cloud Native Buildpacks jammy tiny stack.
    35  	JammyTinyStackID = "io.buildpacks.stacks.jammy.tiny"
    36  
    37  	// JammyStaticStackID is the ID for the Cloud Native Buildpacks jammy static stack.
    38  	JammyStaticStackID = "io.buildpacks.stacks.jammy.static"
    39  )
    40  
    41  // IsBionicStack returns true if the stack is one of the bionic variants
    42  func IsBionicStack(stack string) bool {
    43  	return BionicStackID == stack || BionicTinyStackID == stack || TinyStackID == stack
    44  }
    45  
    46  // IsJammyStack returns true if the stack is one of the jammy variants
    47  func IsJammyStack(stack string) bool {
    48  	return JammyStackID == stack || JammyTinyStackID == stack || JammyStaticStackID == stack
    49  }
    50  
    51  // IsTinyStack returns true if the stack is one of the tiny variants
    52  func IsTinyStack(stack string) bool {
    53  	return BionicTinyStackID == stack || JammyTinyStackID == stack || TinyStackID == stack
    54  }
    55  
    56  // IsStaticStack returns true if the stack is one of the static variants
    57  func IsStaticStack(stack string) bool {
    58  	return JammyStaticStackID == stack
    59  }
    60  
    61  // IsShellPresentOnStack returns true if the stack is known to have a shell
    62  func IsShellPresentOnStack(stack string) bool {
    63  	return BionicStackID == stack || JammyStackID == stack
    64  }