Skip to content

Commit

Permalink
Merge pull request #268 from paketo-buildpacks/update/pipeline
Browse files Browse the repository at this point in the history
Bump pipeline from 1.38.0 to 1.39.0
  • Loading branch information
dmikusa authored May 22, 2024
2 parents 5d04f7a + 82499a2 commit dec428f
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/pipeline-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.38.0
1.39.0
8 changes: 4 additions & 4 deletions .github/workflows/pb-create-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ jobs:
username: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }}
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: Install create-package
run: |
#!/usr/bin/env bash
set -euo pipefail
go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/create-package@latest
- uses: buildpacks/github-actions/setup-tools@v5.5.3
- uses: buildpacks/github-actions/setup-tools@v5.6.0
with:
crane-version: 0.19.0
crane-version: 0.19.1
yj-version: 5.1.0
- name: Install pack
run: |
Expand Down Expand Up @@ -219,7 +219,7 @@ jobs:
DIGEST: ${{ steps.package.outputs.digest }}
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
- if: ${{ true }}
uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.5.3
uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.6.0
with:
address: docker.io/paketobuildpacks/encrypt-at-rest@${{ steps.package.outputs.digest }}
id: paketo-buildpacks/encrypt-at-rest
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pb-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: Install create-package
run: |
#!/usr/bin/env bash
Expand Down Expand Up @@ -178,6 +178,7 @@ jobs:
env:
FORMAT: image
PACKAGES: test
TTL_SH_PUBLISH: "false"
VERSION: ${{ steps.version.outputs.version }}
unit:
name: Unit Test
Expand All @@ -192,7 +193,7 @@ jobs:
restore-keys: ${{ runner.os }}-go-
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: Install richgo
run: |
#!/usr/bin/env bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pb-update-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- uses: actions/checkout@v4
- name: Update Go Version & Modules
id: update-go
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
echo "commit-body=${COMMIT_BODY}" >> "$GITHUB_OUTPUT"
echo "commit-semver=${COMMIT_SEMVER}" >> "$GITHUB_OUTPUT"
env:
GO_VERSION: "1.20"
GO_VERSION: "1.22"
- uses: peter-evans/create-pull-request@v6
with:
author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com>
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pb-update-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: Install octo
run: |
#!/usr/bin/env bash
Expand Down
8 changes: 2 additions & 6 deletions dare/build_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,6 @@
package dare_test

import (
"io/ioutil"
"os"
"testing"

Expand All @@ -41,10 +40,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) {
)

it.Before(func() {
var err error

ctx.Application.Path, err = ioutil.TempDir("", "build")
Expect(err).NotTo(HaveOccurred())
ctx.Application.Path = t.TempDir()

kp = &mocks.KeyProvider{}
build.KeyProviders = append(build.KeyProviders, kp)
Expand Down
7 changes: 3 additions & 4 deletions dare/encrypt.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,6 @@ import (
"crypto/sha256"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -68,7 +67,7 @@ func (e Encrypt) Contribute(layer libcnb.Layer) (libcnb.Layer, error) {

e.Logger.Body("Writing salt")
file := filepath.Join(layer.Path, "salt")
if err := ioutil.WriteFile(file, salt[:], 0644); err != nil {
if err := os.WriteFile(file, salt[:], 0644); err != nil {
return libcnb.Layer{}, fmt.Errorf("unable to write %s\n%w", file, err)
}
layer.LaunchEnvironment.Default("BPI_EAR_SALT_PATH", file)
Expand Down Expand Up @@ -110,7 +109,7 @@ func (e Encrypt) Contribute(layer libcnb.Layer) (libcnb.Layer, error) {
}

e.Logger.Header("Removing source code")
cs, err := ioutil.ReadDir(e.ApplicationPath)
cs, err := os.ReadDir(e.ApplicationPath)
if err != nil {
return libcnb.Layer{}, fmt.Errorf("unable to list children of %s\n%w", e.ApplicationPath, err)
}
Expand Down
16 changes: 5 additions & 11 deletions dare/encrypt_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,6 @@ import (
"crypto/sha256"
"encoding/hex"
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand All @@ -43,13 +42,8 @@ func testEncrypt(t *testing.T, context spec.G, it spec.S) {
)

it.Before(func() {
var err error

ctx.Application.Path, err = ioutil.TempDir("", "encrypt-application")
Expect(err).NotTo(HaveOccurred())

ctx.Layers.Path, err = ioutil.TempDir("", "encrypt-layers")
Expect(err).NotTo(HaveOccurred())
ctx.Application.Path = t.TempDir()
ctx.Layers.Path = t.TempDir()
})

it.After(func() {
Expand All @@ -58,7 +52,7 @@ func testEncrypt(t *testing.T, context spec.G, it spec.S) {
})

it("contributes encrypt", func() {
Expect(ioutil.WriteFile(filepath.Join(ctx.Application.Path, "fixture-marker"), []byte{}, 0644)).To(Succeed())
Expect(os.WriteFile(filepath.Join(ctx.Application.Path, "fixture-marker"), []byte{}, 0644)).To(Succeed())

master, err := hex.DecodeString("E48F0660412A993E62FB11CA086C2D353C95359AD3A3480E778FBA43DB694E60")
Expect(err).NotTo(HaveOccurred())
Expand All @@ -81,7 +75,7 @@ func testEncrypt(t *testing.T, context spec.G, it spec.S) {

Expect(layer.LaunchEnvironment["BPI_EAR_DECRYPTED_APPLICATION.default"]).To(Equal(ctx.Application.Path))

salt, err := ioutil.ReadFile(filepath.Join(layer.Path, "salt"))
salt, err := os.ReadFile(filepath.Join(layer.Path, "salt"))
Expect(err).NotTo(HaveOccurred())

var key [32]byte
Expand Down
9 changes: 4 additions & 5 deletions helper/decrypt.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,6 @@ import (
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"os"

"github.com/minio/sio"
Expand Down Expand Up @@ -50,7 +49,7 @@ func (d Decrypt) Execute() (map[string]string, error) {
if !ok {
return nil, fmt.Errorf("$BPI_EAR_SALT_PATH must be set")
}
salt, err := ioutil.ReadFile(file)
salt, err := os.ReadFile(file)
if err != nil {
return nil, fmt.Errorf("unable to open %s\n%w", file, err)
}
Expand All @@ -70,7 +69,7 @@ func (d Decrypt) Execute() (map[string]string, error) {
return nil, fmt.Errorf("$BPI_EAR_DECRYPTED_APPLICATION must be set")
}
if unix.Access(file, unix.W_OK) != nil {
d.Logger.Info("ERROR: Unable to decrypt application because %s is not writable", file)
d.Logger.Infof("ERROR: Unable to decrypt application because %s is not writable", file)
return nil, fmt.Errorf("unable to write to %s", file)
}
out := file
Expand All @@ -86,7 +85,7 @@ func (d Decrypt) Execute() (map[string]string, error) {
return nil, fmt.Errorf("unable to create encrypted reader\n%w", err)
}

if err := crush.ExtractTar(r, out, 0); err != nil {
if err := crush.Extract(r, out, 0); err != nil {
return nil, fmt.Errorf("unable to extract TAR %s to %s\n%w", in.Name(), out, err)
}

Expand Down
14 changes: 6 additions & 8 deletions helper/decrypt_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,6 @@ import (
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -50,17 +49,16 @@ func testDecrypt(t *testing.T, context spec.G, it spec.S) {
it.Before(func() {
var err error

decryptedPath, err = ioutil.TempDir("", "decrypt-decrypted")
Expect(err).NotTo(HaveOccurred())
decryptedPath = t.TempDir()

f, err := ioutil.TempFile("", "decrypt-encrypted")
f, err := os.CreateTemp("", "decrypt-encrypted")
Expect(err).NotTo(HaveOccurred())
Expect(f.Close()).To(Succeed())
encryptedPath = f.Name()

key = "E48F0660412A993E62FB11CA086C2D353C95359AD3A3480E778FBA43DB694E60"

f, err = ioutil.TempFile("", "decrypt-salt")
f, err = os.CreateTemp("", "decrypt-salt")
Expect(err).NotTo(HaveOccurred())
Expect(f.Close()).To(Succeed())
saltPath = f.Name()
Expand Down Expand Up @@ -138,7 +136,7 @@ func testDecrypt(t *testing.T, context spec.G, it spec.S) {
var salt [32]byte
_, err = io.ReadFull(rand.Reader, salt[:])
Expect(err).NotTo(HaveOccurred())
Expect(ioutil.WriteFile(saltPath, salt[:], 0644)).To(Succeed())
Expect(os.WriteFile(saltPath, salt[:], 0644)).To(Succeed())

var key [32]byte
kdf := hkdf.New(sha256.New, primary, salt[:], nil)
Expand All @@ -152,7 +150,7 @@ func testDecrypt(t *testing.T, context spec.G, it spec.S) {
Expect(err).NotTo(HaveOccurred())

file := filepath.Join(decryptedPath, "fixture-marker")
Expect(ioutil.WriteFile(file, []byte{}, 0644)).To(Succeed())
Expect(os.WriteFile(file, []byte{}, 0644)).To(Succeed())
Expect(crush.CreateTar(w, decryptedPath)).To(Succeed())
Expect(os.RemoveAll(file)).To(Succeed())

Expand Down

0 comments on commit dec428f

Please sign in to comment.