Skip to content

Commit

Permalink
Merge branch 'main' into
Browse files Browse the repository at this point in the history
dependabot/go_modules/github.com/docker/docker-27.0.0incompatible
  • Loading branch information
hilmarf committed Jun 25, 2024
2 parents 84a902f + daacfbe commit 9260840
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 16 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/flake_vendorhash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ on:
paths:
- go.mod
- go.sum
workflow_dispatch:
workflow_call:
pull_request:
paths:
- go.mod
- go.sum

jobs:
updateVendorHash:
Expand Down Expand Up @@ -36,12 +38,14 @@ jobs:
- name: Update ocm vendor hash
run: nix run .#nixpkgs.nix-update -- --flake --version=skip ocm
- name: Check diff and create action summary
id: check-diff
id: diff
run: |
diff=$(git diff)
if [[ -z "$diff" ]]; then
echo "Everything is tidy."
exit 0
else
echo "exists=true" >> "$GITHUB_OUTPUT"
fi
cat << EOF >> "${GITHUB_STEP_SUMMARY}"
Updates the vendorHash in \`flake.nix\`
Expand All @@ -54,8 +58,14 @@ jobs:
\`\`\`
EOF
- name: Create Commit
if: ${{ steps.diff.outputs.exists }}
# https://docs.github.com/de/rest/repos/contents?apiVersion=2022-11-28#create-or-update-file-contents
run: |
FILE=flake.nix
echo "{\"message\":\"auto update vendor hash\",\"content\":\"$(base64 -w0 ${FILE})\",\"sha\":\"$(git rev-parse :${FILE})\"}" > input.json
gh api -X PUT https://api.github.com/repos/open-component-model/ocm/contents/${FILE} --input input.json
BRANCH=${{ github.head_ref }}
echo "{\"message\":\"auto update vendor hash\",\"content\":\"$(base64 -w0 ${FILE})\",\"sha\":\"$(git rev-parse :${FILE})\"" > input.json
if [[ -n "$BRANCH" ]]; then
echo ",\"branch\":\"${{ github.head_ref }}\"" >> input.json
fi
echo "}" >> input.json
gh api -X PUT https://api.github.com/repos/${{ github.repository }}/contents/${FILE} --input input.json
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ go.mod.bak
dist/
.cache_ggshield
.DS_Store
.project
.classpath
.settings/
*.exe
.secrets
*.log
10 changes: 0 additions & 10 deletions cmds/ocm/ca/component-descriptor.yaml

This file was deleted.

37 changes: 37 additions & 0 deletions cmds/ocm/ocm_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main_test

import (
"os"

. "github.com/mandelsoft/goutils/testutils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/open-component-model/ocm/cmds/ocm/testhelper"

"github.com/open-component-model/ocm/pkg/common/accessio"
"github.com/open-component-model/ocm/pkg/contexts/oci/attrs/cacheattr"
)

var _ = Describe("OCM command line test Environment", func() {
var env *TestEnv

BeforeEach(func() {
env = NewTestEnv(TestData())
})

AfterEach(func() {
env.Cleanup()
})

It("Add OCI image resource fails when a cache directory is specified on Windows", func() {
tmp := Must(os.MkdirTemp("", "ocm-cache-*"))
defer os.RemoveAll(tmp)
// configure ocm cache
MustBeSuccessful(cacheattr.Set(env.OCIContext(), Must(accessio.NewStaticBlobCache(tmp))))

// ocm create ca --file ca --scheme ocm.software/v3alpha1 --provider test.com test.com/postgresql 14.0.5
Expect(env.Execute("create", "ca", "--file", "ca", "--scheme", "ocm.software/v3alpha1", "--provider", "test.com", "test.com/postgresql", "14.0.5")).To(Succeed())
// ocm add resource --file ca --name bitnami-shell --type ociImage --accessType ociArtifact --version 10 --reference bitnami/postgresql:16.2.0-debian-11-r1
Expect(env.Execute("add", "resource", "--file", "ca", "--name", "bitnami-shell", "--type", "ociImage", "--accessType", "ociArtifact", "--version", "10", "--reference", "bitnami/postgresql:16.2.0-debian-11-r1")).To(Succeed())
})
})
13 changes: 13 additions & 0 deletions cmds/ocm/suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main_test

import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

func TestConfig(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "OCM command line tests - for bug verification")
}
2 changes: 1 addition & 1 deletion pkg/common/accessio/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ func (c *blobCache) AddBlob(blob blobaccess.BlobAccess) (int64, digest.Digest, e
if err != nil {
return blobaccess.BLOB_UNKNOWN_SIZE, "", errors.Wrapf(err, "cannot create blob file in cache")
}
defer writer.Close()
size, err := io.Copy(writer, reader)
writer.Close()
if err != nil {
c.cache.Remove(tmp)
return blobaccess.BLOB_UNKNOWN_SIZE, "", err
Expand Down

0 comments on commit 9260840

Please sign in to comment.