diff --git a/.github/workflows/assign-to-project.yaml b/.github/workflows/assign-to-project.yaml deleted file mode 100644 index 690828d..0000000 --- a/.github/workflows/assign-to-project.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# https://github.com/marketplace/actions/assign-to-one-project - -name: Assign to Project - -on: - issues: - types: [opened, labeled] - pull_request_target: - types: [opened, labeled] -env: - MY_GITHUB_TOKEN: ${{ secrets.ASSIGN_PROJECT_TOKEN }} - -jobs: - assign_project: - runs-on: ubuntu-latest - name: Assign Issue to Project - steps: - - name: Assign Issue to Project - uses: srggrs/assign-one-project-github-action@1.3.1 - if: ${{ github.event_name == 'issues' }} - with: - project: 'https://github.com/orgs/getporter/projects/1' - column_name: 'Inbox' - - name: Assign Pull Request to Project - uses: srggrs/assign-one-project-github-action@1.3.1 - if: ${{ github.event_name == 'pull_request_target' }} - with: - project: 'https://github.com/orgs/getporter/projects/1' - column_name: 'In Progress' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9041d7..5a8e7e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,21 +8,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Cache - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.18 - check-latest: true + go-version-file: go.mod - name: Set up Mage run: go run mage.go ConfigureAgent - name: Build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ec07d4e..bfd450d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,27 +11,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Cache - uses: actions/cache@v2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.18 - check-latest: true + go-version-file: go.mod - name: Set up Mage run: go run mage.go ConfigureAgent - - name: Test + - name: Build run: mage -v Build + - name: Test + run: mage -v Test - name: Docker Login - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} diff --git a/.gitignore b/.gitignore index 979493f..a2eb95a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .cnab/ bin/ - +.vscode/ diff --git a/exec-outputs/Dockerfile.tmpl b/exec-outputs/Dockerfile.tmpl index ed838fa..665b196 100644 --- a/exec-outputs/Dockerfile.tmpl +++ b/exec-outputs/Dockerfile.tmpl @@ -4,19 +4,7 @@ ARG BUNDLE_DIR # Install jq, we aren't using the mixin because it's an example bundle and jq # isn't a default mixin -RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* -RUN apt-get update && apt-get install gnupg2 -y -ENV JQ_VERSION='1.6' -RUN wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/jq-release.key -O /tmp/jq-release.key && \ - wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/v${JQ_VERSION}/jq-linux64.asc -O /tmp/jq-linux64.asc && \ - wget --no-check-certificate https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 -O /tmp/jq-linux64 && \ - gpg --import /tmp/jq-release.key && \ - gpg --verify /tmp/jq-linux64.asc /tmp/jq-linux64 && \ - cp /tmp/jq-linux64 /usr/bin/jq && \ - chmod +x /usr/bin/jq && \ - rm -f /tmp/jq-release.key && \ - rm -f /tmp/jq-linux64.asc && \ - rm -f /tmp/jq-linux64 +RUN apt-get update && apt-get install gnupg2 jq -y && rm -rf /var/lib/apt/lists/* # Use the BUNDLE_DIR build argument to copy files into the bundle COPY . ${BUNDLE_DIR} diff --git a/go.mod b/go.mod index f3cb898..550f72e 100644 --- a/go.mod +++ b/go.mod @@ -1,32 +1,34 @@ module get.porter.sh/example-bundles -go 1.18 +go 1.21 + +toolchain go1.21.3 require ( - get.porter.sh/magefiles v0.3.2 + get.porter.sh/magefiles v0.6.8 github.com/carolynvs/magex v0.9.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/magefile/mage v1.14.0 + github.com/magefile/mage v1.15.0 github.com/stretchr/testify v1.8.0 golang.org/x/sync v0.0.0-20220907140024-f12130a52804 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/Masterminds/semver/v3 v3.1.1 // indirect - github.com/andybalholm/brotli v1.0.4 // indirect + github.com/Masterminds/semver/v3 v3.2.1 // indirect + github.com/andybalholm/brotli v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/klauspost/compress v1.15.10 // indirect - github.com/klauspost/pgzip v1.2.5 // indirect + github.com/klauspost/compress v1.17.7 // indirect + github.com/klauspost/pgzip v1.2.6 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/mholt/archiver/v3 v3.5.1 // indirect github.com/nwaples/rardecode v1.1.3 // indirect - github.com/pierrec/lz4/v4 v4.1.16 // indirect + github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.8.1 // indirect - github.com/ulikunitz/xz v0.5.10 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect ) diff --git a/go.sum b/go.sum index d50612b..44eaae3 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,16 @@ get.porter.sh/magefiles v0.3.2 h1:RDJini5LBQ8pYnc0r8M6cX2Pk+CPsCtyFwO3fy8Jb5g= get.porter.sh/magefiles v0.3.2/go.mod h1:w8ikniAFHO7AVvWayyWF7ViHoh4tNKwTxtKpO1FyGkU= +get.porter.sh/magefiles v0.6.8 h1:1q0CmKgOtlP8IBXtRNLv2+r9tLiC96tpIPhTHX+HlUw= +get.porter.sh/magefiles v0.6.8/go.mod h1:w37oTKICvvaEKR5KVB9UfN2EX30uYO9Qk0oRoz80DOU= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= +github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/carolynvs/magex v0.9.0 h1:fWe7oshGv6zuei5Z6EI95RSlOKjIifBZ26myB9G+m/I= github.com/carolynvs/magex v0.9.0/go.mod h1:H1LW6RYJ/sNbisMmPe9E73aJZa8geKLKK9mBWLWz3ek= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -27,9 +33,13 @@ github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.15.10 h1:Ai8UzuomSCDw90e1qNMtb15msBXsNpH6gzkkENQNcJo= github.com/klauspost/compress v1.15.10/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= +github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= @@ -40,6 +50,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo= github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= +github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo= github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4= github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= @@ -48,6 +60,8 @@ github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWk github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.16 h1:kQPfno+wyx6C5572ABwV+Uo3pDFzQ7yhyGchSyRda0c= github.com/pierrec/lz4/v4 v4.1.16/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= +github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -63,6 +77,8 @@ github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oW github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= golang.org/x/sync v0.0.0-20220907140024-f12130a52804 h1:0SH2R3f1b1VmIMG7BXbEZCBUu2dKmHschSmjqGUrW8A= diff --git a/mage/examples/examples.go b/mage/examples/examples.go index 5fb97f3..b523b72 100644 --- a/mage/examples/examples.go +++ b/mage/examples/examples.go @@ -2,7 +2,6 @@ package examples import ( "fmt" - "io/ioutil" "os" "path/filepath" @@ -12,7 +11,7 @@ import ( // GetBundleRef builds the reference to the specified example bundle, given a registry override. func GetBundleRef(bundleDir string, registryOverride string) (string, error) { manifestPath := filepath.Join(bundleDir, "porter.yaml") - contents, err := ioutil.ReadFile(manifestPath) + contents, err := os.ReadFile(manifestPath) if err != nil { return "", fmt.Errorf("error reading porter manifest at %s: %w", manifestPath, err) } @@ -46,7 +45,7 @@ func GetBundleRef(bundleDir string, registryOverride string) (string, error) { // List returns the names of all example bundles in the specified directory. func List(dir string) ([]string, error) { - results, err := ioutil.ReadDir(dir) + results, err := os.ReadDir(dir) if err != nil { return nil, fmt.Errorf("error listing example bundles in current directory: %w", err) } diff --git a/mage/examples/examples_test.go b/mage/examples/examples_test.go index 99a1371..d531048 100644 --- a/mage/examples/examples_test.go +++ b/mage/examples/examples_test.go @@ -1,7 +1,6 @@ package examples import ( - "io/ioutil" "os" "testing" @@ -12,7 +11,7 @@ import ( ) func TestListExampleBundles(t *testing.T) { - tmp, err := ioutil.TempDir("", "example-bundles") + tmp, err := os.MkdirTemp("", "example-bundles") require.NoError(t, err) defer os.RemoveAll(tmp) diff --git a/mage/setup/mixins.go b/mage/setup/mixins.go index 10ade51..3c3b0cc 100644 --- a/mage/setup/mixins.go +++ b/mage/setup/mixins.go @@ -17,9 +17,7 @@ func InstallMixins() error { {Name: "docker"}, {Name: "docker-compose"}, {Name: "exec"}, - // Use a build of helm3 that supports nonroot - // https://github.com/MChorfa/porter-helm3/pull/42 - {Name: "helm3", Feed: "https://mchorfa.github.io/porter-helm3/atom.xml", Version: "v1.0.0-rc.1"}, + {Name: "helm3", Feed: "https://mchorfa.github.io/porter-helm3/atom.xml", Version: "v1.0.1"}, {Name: "kubernetes"}, {Name: "terraform"}, } @@ -34,5 +32,5 @@ func InstallMixins() error { } func EnsurePorter() { - porter.EnsurePorterAt("v1.0.0-rc.1") + porter.EnsurePorter() } diff --git a/magefile.go b/magefile.go index 0ec8ff5..68f6876 100644 --- a/magefile.go +++ b/magefile.go @@ -6,13 +6,13 @@ package main import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" "get.porter.sh/example-bundles/mage/examples" "get.porter.sh/example-bundles/mage/setup" + "get.porter.sh/magefiles/git" "get.porter.sh/magefiles/porter" "github.com/carolynvs/magex/mgx" @@ -57,7 +57,7 @@ func BuildExample(name string) error { fmt.Println("\n==========================") fmt.Printf("Building example bundle: %s\n", name) - if customBuildFlags, err := ioutil.ReadFile(filepath.Join(name, "build-args.txt")); err == nil { + if customBuildFlags, err := os.ReadFile(filepath.Join(name, "build-args.txt")); err == nil { customBuildArgs := strings.Split(string(customBuildFlags), " ") buildArgs := append([]string{"build"}, customBuildArgs...) return shx.Command("porter", buildArgs...). @@ -118,3 +118,9 @@ func PublishExample(name string) error { fmt.Printf("Publishing example bundle: %s\n", name) return shx.Command("porter", "publish", registryFlag).CollapseArgs().In(name).RunV() } + +// SetupDCO configures your git repository to automatically sign your commits +// to comply with our DCO +func SetupDCO() error { + return git.SetupDCO() +}