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

Golden Path Changes - Part 2 #481

Merged
merged 18 commits into from
Mar 15, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
6 changes: 3 additions & 3 deletions .github/workflows/create-debugging-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ secrets.RELEEN_GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version-file: go.mod
check-latest: true

- name: Build
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ secrets.RELEEN_GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.21"
check-latest: true
go-version-file: go.mod

- name: Build
run: go build ./...
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
name: test
on:
push:
branches:
- main
branches: ["main"]
pull_request:
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ secrets.RELEEN_GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.21"
check-latest: true
go-version-file: go.mod

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ These are the mappings from bake flag to each field in a bake_configurations ele
| `"properties_directories"` | `--properties-directory=` | This may be a list of directories. |
| `"runtime_configurations_directories"` | `--runtime-configs-directory=` | This may be a list of directories. |
| `"bosh_variables_directories"` | `--bosh-variables-directory=` | This may be a list of directories. |
| `"embed_paths_directories"` | `--embed=` | This may be a list of directories. |
| `"embed_files"` | `--embed=` | This may be a list of filepaths. |
| `"variable_files"` | `--variables-file=` | This may be a list of filepaths. |

### The Lock File [(source)](https://pkg.go.dev/github.com/pivotal-cf/kiln/pkg/cargo#Kilnfile)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ require (
github.com/pivotal-cf/om v0.0.0-20230707145702-e2ef8fd451b1
github.com/snabb/httpreaderat v1.0.1
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.19.0
golang.org/x/crypto v0.21.0
golang.org/x/oauth2 v0.16.0
golang.org/x/sync v0.6.0
golang.org/x/term v0.17.0
golang.org/x/term v0.18.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -121,7 +121,7 @@ require (
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -804,6 +806,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -813,6 +817,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
8 changes: 4 additions & 4 deletions internal/acceptance/bake/bake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ var _ = Describe("bake command", func() {
file, err := bakedTile.Open("metadata/metadata.yml")
Expect(err).NotTo(HaveOccurred())

info, err := file.Stat()
Expect(err).NotTo(HaveOccurred())
Expect(info.ModTime()).To(Equal(time.Unix(0, 0).In(time.UTC)))

metadataContents, err := io.ReadAll(file)
Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -874,7 +878,6 @@ some_runtime_configs:
serial: false
selected_value: "235"
kiln_metadata:
kiln_version: 0.0.0-dev.0+acceptance
metadata_git_sha: %s
`

Expand All @@ -899,7 +902,6 @@ stemcell_criteria:
requires_cpi: false
enable_patch_security_updates: true
kiln_metadata:
kiln_version: 0.0.0-dev.0+acceptance
metadata_git_sha: %s
`

Expand All @@ -921,7 +923,6 @@ additional_stemcells_criteria:
- os: windows
version: "2019.4"
kiln_metadata:
kiln_version: 0.0.0-dev.0+acceptance
metadata_git_sha: %s
`

Expand All @@ -940,6 +941,5 @@ stemcell_criteria:
os: ubuntu-trusty
version: "3215.4"
kiln_metadata:
kiln_version: 0.0.0-dev.0+acceptance
metadata_git_sha: %s
`
6 changes: 0 additions & 6 deletions internal/acceptance/workflows/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ import (
"github.com/pivotal-cf/kiln/internal/acceptance/workflows/scenario"
)

func TestMain(m *testing.M) {
code := m.Run()
_ = exec.Command("git", "submodule", "update", "--init", "--recursive", "hello-tile").Run()
os.Exit(code)
}

func Test_baking_a_tile(t *testing.T) {
// t.SkipNow()
setupAndRunFeatureTest(t)
Expand Down
16 changes: 14 additions & 2 deletions internal/acceptance/workflows/baking_a_tile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ Feature: As a developer, I want to bake a tile
| releases/hello-release-0.2.3.tgz |
And "bake_records/0.2.0-dev.json" contains substring: "version": "0.2.0-dev"
And "bake_records/0.2.0-dev.json" contains substring: "source_revision": "bc3ac24e192ba06a2eca19381ad785ec7069e0d0"
And "bake_records/0.2.0-dev.json" contains substring: "tile_directory": "."
And "bake_records/0.2.0-dev.json" contains substring: "kiln_version": "0.0.0+acceptance-tests"
And "bake_records/0.2.0-dev.json" contains substring: "file_checksum": "342fd94f1f3ccaaa1b964977067a1d89915b2c6957242d18bd1ef39babcda915"
And "tile-0.2.0-dev.pivotal" has sha256 sum "342fd94f1f3ccaaa1b964977067a1d89915b2c6957242d18bd1ef39babcda915"
And "bake_records/0.2.0-dev.json" contains substring: "file_checksum": "5f8abc7a3272a70fa716cdf120f6976f6b78e16a01a4b3e085ced7f51d6c7691"
And "tile-0.2.0-dev.pivotal" has sha256 sum "5f8abc7a3272a70fa716cdf120f6976f6b78e16a01a4b3e085ced7f51d6c7691"

Scenario: it reads directory configuration from Kilnfile
Given I have a tile source directory "testdata/tiles/non-standard-paths"
When I invoke kiln
| bake |
| --stub-releases |
Then a Tile is created

Scenario: it bakes a tile from a bake record
Given I have a tile source directory "testdata/tiles/bake-record"
When I invoke kiln
| re-bake |
| --output-file=tile-0.1.0.pivotal |
| tile/bake_records/0.1.0.json |
Then a Tile is created
And the Tile contains
| metadata/metadata.yml |
| releases/bpm-1.1.21.tgz |
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ func iHaveATileDirectory(ctx context.Context, tileDirectory string) (context.Con
return ctx, fmt.Errorf("failed to create new copy of tile directory: %w", err)
}

dir, err := copyTileDirectory(tmpDir, tileDirectory)
resolvedDir, err := filepath.EvalSymlinks(tmpDir)
if err != nil {
return ctx, fmt.Errorf("failed to resolve symlinks for test tile directory: %w", err)
}

dir, err := copyTileDirectory(resolvedDir, tileDirectory)
if err != nil {
return ctx, err
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
releases/*.tgz
*.pivotal
bake_records/*.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
slug: min
release_sources:
- type: bosh.io
releases:
- name: bpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
releases:
- name: bpm
sha1: e8abe19ec186962828de843f8f281cddb6141904
version: 1.1.21
remote_source: bosh.io
remote_path: https://bosh.io/d/github.com/cloudfoundry/bpm-release?v=1.1.21
stemcell_criteria:
os: ubuntu-xenial
version: "621.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"source_revision": "4b872e02af39ac7a025af39e1da55b3e0a3cbfe0",
"version": "0.1.0",
"kiln_version": "0.0.0+acceptance-tests",
"tile_directory": "tile",
"file_checksum": "781290c114d1e06f44e4bf05c22b5b03ee576f6526b28b103417050934f878b3"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
name: bpm
label: BPM
description: It just installs the BOSH Package Manager on an instance
icon_image: $( icon )

metadata_version: "2.7.0"
minimum_version_for_upgrade: 0.1.0
product_version: $( version )
provides_product_versions:
- name: bpm
version: $( version )

rank: 90
serial: false

releases:
- $( release "bpm" )

stemcell_criteria: $( stemcell )

job_types:
- name: hello-server
label: Server
resource_label: Server
description: HTTP Server

templates:
- name: bpm
release: bpm
manifest: {}

static_ip: 1
dynamic_ip: 0

max_in_flight: 1
single_az_only: true

instance_definition:
name: instances
type: integer
label: Instances
configurable: true
default: 1
constraints:
min: 0
max: 1

resource_definitions:
- name: ram
type: integer
label: RAM
configurable: true
default: 1024
constraints:
min: 1024

- name: ephemeral_disk
type: integer
label: Ephemeral Disk
configurable: true
default: 4000
constraints:
min: 2000

- name: persistent_disk
type: integer
label: Persistent Disk
configurable: false
default: 4000
constraints:
min: 2000

- name: cpu
type: integer
label: CPU
configurable: true
default: 1
constraints:
min: 1

runtime_configs: []
property_blueprints: []
form_types: []
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
1 change: 1 addition & 0 deletions internal/acceptance/workflows/using_kiln.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Feature: As a developer, I want the Kiln CLI to be usable
Examples:
| command |
| bake |
| re-bake |
| fetch |
| find-release-version |
| find-stemcell-version |
Expand Down
1 change: 0 additions & 1 deletion internal/builder/interpolator.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type Interpolator struct{}

type InterpolateInput struct {
Version string
KilnVersion string
BOSHVariables map[string]any
Variables map[string]any
ReleaseManifests map[string]any
Expand Down
Loading
Loading