diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ca9d82c..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,106 +0,0 @@ -version: 2.1 - -orbs: - codacy: codacy/base@9.3.5 - -jobs: - build: # runs not using Workflows must have a `build` job as entry point - docker: # run the steps with Docker - - image: cimg/go:1.19 # - - # directory where steps are run. Path must conform to the Go Workspace requirements - working_directory: ~/workdir/helm-ssm - - environment: # environment variables for the build itself - TEST_RESULTS: /tmp/test-results # path to where test results will be saved - - steps: # steps that comprise the `build` job - - attach_workspace: - at: ~/workdir/helm-ssm - - - run: mkdir -p $TEST_RESULTS # create the test results directory - - - restore_cache: # restores saved cache if no changes are detected since last run - # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ - keys: - - v2020-09-pkg-cache - - - run: go install github.com/jstemmer/go-junit-report/v2@v2.0.0 - - - run: - name: Run unit tests - # Store the results of our tests in the $TEST_RESULTS directory - command: | - make test | go-junit-report >> ${TEST_RESULTS}/go-test-report.xml - - - run: make dist # pull and build dependencies for the project - - - persist_to_workspace: - root: ~/workdir/helm-ssm - paths: - - '*' - - - save_cache: # Store cache in the /go/pkg directory - key: v1-pkg-cache - paths: - - "/go/pkg" - - - store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ - path: /tmp/test-results - destination: raw-test-output - - - store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ - path: /tmp/test-results - - publish: # runs not using Workflows must have a `build` job as entry point - docker: # run the steps with Docker - - image: cimg/go:1.19 # - - # directory where steps are run. Path must conform to the Go Workspace requirements - working_directory: ~/workdir/helm-ssm - steps: # steps that comprise the `build` job - - attach_workspace: - at: ~/workdir/helm-ssm - - - run: - name: "Publish Release on GitHub" - command: | - export VERSION="$(cat .version)" - echo "Publishing version ${VERSION}" - ls -lisah ./_dist/ - - curl -L https://github.com/cli/cli/releases/download/v1.1.0/gh_1.1.0_linux_amd64.deb -o gh.deb - sudo dpkg -i gh.deb - echo ${GITHUB_TOKEN} | gh auth login --with-token - gh config set prompt disabled - gh release create ${VERSION} ./_dist/*.tgz - - -workflows: - version: 2 - ci: - jobs: - - codacy/checkout_and_version - - build: - requires: - - codacy/checkout_and_version - - codacy/tag_version: - name: tag_version - context: CodacyAWS - requires: - - build - filters: - branches: - only: - - master - - publish: - context: CodacyGitHub - requires: - - tag_version - - codacy/tag_version: - name: tag_version_latest - context: CodacyAWS - version: latest - force: true - requires: - - publish \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index bf17397..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,4 +0,0 @@ -* @lolgab @ljmf00 @andreaTP @rtfpessoa @bmbferreira @DReigada @pedrocodacy - -*.yml @h314to @paulopontesm - diff --git a/.github/workflows/comment_issue.yml b/.github/workflows/comment_issue.yml deleted file mode 100644 index 12fb218..0000000 --- a/.github/workflows/comment_issue.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Comment issue on Jira - -on: - issue_comment: - types: [created] - -jobs: - jira: - env: - JIRA_CREATE_COMMENT_AUTO: ${{ secrets.JIRA_CREATE_COMMENT_AUTO }} - runs-on: ubuntu-latest - steps: - - - name: Start workflow if JIRA_CREATE_COMMENT_AUTO is enabled - if: env.JIRA_CREATE_COMMENT_AUTO == 'true' - run: echo "Starting workflow" - - - name: Check GitHub Issue type - if: env.JIRA_CREATE_COMMENT_AUTO == 'true' - id: github_issue_type - uses: actions/github-script@v2.0.0 - with: - result-encoding: string - script: | - // An Issue can be a pull request, you can identify pull requests by the pull_request key - const pullRequest = ${{ toJson(github.event.issue.pull_request) }} - if(pullRequest) { - return "pull-request" - } else { - return "issue" - } - - - name: Check if GitHub Issue has JIRA_ISSUE_LABEL - if: env.JIRA_CREATE_COMMENT_AUTO == 'true' - id: github_issue_has_jira_issue_label - uses: actions/github-script@v2.0.0 - env: - JIRA_ISSUE_LABEL: ${{ secrets.JIRA_ISSUE_LABEL }} - with: - result-encoding: string - script: | - const labels = ${{ toJson(github.event.issue.labels) }} - if(labels.find(label => label.name == process.env.JIRA_ISSUE_LABEL)) { - return "true" - } else { - return "false" - } - - - name: Continue workflow only for Issues (not Pull Requests) tagged with JIRA_ISSUE_LABEL - if: env.JIRA_CREATE_COMMENT_AUTO == 'true' && env.GITHUB_ISSUE_TYPE == 'issue' && env.GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL == 'true' - env: - GITHUB_ISSUE_TYPE: ${{ steps.github_issue_type.outputs.result }} - GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL: ${{ steps.github_issue_has_jira_issue_label.outputs.result }} - run: echo "GitHub Issue is tracked on Jira, eligilbe to be commented" - - - name: Jira Login - if: env.JIRA_CREATE_COMMENT_AUTO == 'true' && env.GITHUB_ISSUE_TYPE == 'issue' && env.GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL == 'true' - id: login - uses: atlassian/gajira-login@v2.0.0 - env: - GITHUB_ISSUE_TYPE: ${{ steps.github_issue_type.outputs.result }} - GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL: ${{ steps.github_issue_has_jira_issue_label.outputs.result }} - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - - name: Extract Jira number - if: env.JIRA_CREATE_COMMENT_AUTO == 'true' && env.GITHUB_ISSUE_TYPE == 'issue' && env.GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL == 'true' - id: extract_jira_number - uses: actions/github-script@v2.0.0 - env: - GITHUB_ISSUE_TYPE: ${{ steps.github_issue_type.outputs.result }} - GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL: ${{ steps.github_issue_has_jira_issue_label.outputs.result }} - JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }} - GITHUB_TITLE: ${{ github.event.issue.title }} - with: - script: | - const jiraTaskRegex = new RegExp(`\\\[(${process.env.JIRA_PROJECT}-[0-9]+?)\\\]`) - return process.env.GITHUB_TITLE.match(jiraTaskRegex)[1] - result-encoding: string - - - name: Jira Add comment on issue - if: env.JIRA_CREATE_COMMENT_AUTO == 'true' && env.GITHUB_ISSUE_TYPE == 'issue' && env.GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL == 'true' - id: add_comment_jira_issue - uses: atlassian/gajira-comment@v2.0.2 - env: - GITHUB_ISSUE_TYPE: ${{ steps.github_issue_type.outputs.result }} - GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL: ${{ steps.github_issue_has_jira_issue_label.outputs.result }} - with: - issue: ${{ steps.extract_jira_number.outputs.result }} - comment: | - GitHub Comment : ${{ github.event.comment.user.login }} - {quote}${{ github.event.comment.body }}{quote} - ---- - {panel} - _[Github permalink |${{ github.event.comment.html_url }}]_ - {panel} diff --git a/.github/workflows/create_issue.yml b/.github/workflows/create_issue.yml deleted file mode 100644 index 14c9f3b..0000000 --- a/.github/workflows/create_issue.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Create issue on Jira - -on: - issues: - types: [opened] - -jobs: - jira: - env: - JIRA_CREATE_ISSUE_AUTO: ${{ secrets.JIRA_CREATE_ISSUE_AUTO }} - runs-on: ubuntu-latest - steps: - - - name: Start workflow if JIRA_CREATE_ISSUE_AUTO is enabled - if: env.JIRA_CREATE_ISSUE_AUTO == 'true' - run: echo "Starting workflow" - - - name: Jira Login - if: env.JIRA_CREATE_ISSUE_AUTO == 'true' - id: login - uses: atlassian/gajira-login@v2.0.0 - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - - name: Jira Create issue - if: env.JIRA_CREATE_ISSUE_AUTO == 'true' - id: create_jira_issue - uses: atlassian/gajira-create@v2.0.1 - with: - project: ${{ secrets.JIRA_PROJECT }} - issuetype: ${{ secrets.JIRA_ISSUE_TYPE }} - summary: "[GH#${{ github.event.issue.number }}] ${{ github.event.issue.title }}" - description: | - ${{ github.event.issue.body }} - ---- - {panel} - _[Github permalink |${{ github.event.issue.html_url }}]_ - {panel} - - - name: Update Jira issue if JIRA_UPDATE_ISSUE_BODY is defined - if: env.JIRA_CREATE_ISSUE_AUTO == 'true' && env.JIRA_UPDATE_ISSUE_BODY != '' - env: - JIRA_UPDATE_ISSUE_BODY: ${{ secrets.JIRA_UPDATE_ISSUE_BODY }} - run: > - curl - -u ${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }} - -X PUT - -H 'Content-Type: application/json' - -d '${{ env.JIRA_UPDATE_ISSUE_BODY }}' - ${{ secrets.JIRA_BASE_URL }}/rest/api/2/issue/${{ steps.create_jira_issue.outputs.issue }} - - - name: Update GitHub issue - if: env.JIRA_CREATE_ISSUE_AUTO == 'true' - uses: actions/github-script@v2.0.0 - env: - JIRA_ISSUE_NUMBER: ${{ steps.create_jira_issue.outputs.issue }} - GITHUB_ORIGINAL_TITLE: ${{ github.event.issue.title }} - JIRA_ISSUE_LABEL: ${{ secrets.JIRA_ISSUE_LABEL }} - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const newTitle = `[${process.env.JIRA_ISSUE_NUMBER}] ${process.env.GITHUB_ORIGINAL_TITLE}` - github.issues.update({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - title: newTitle - }) - github.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: [process.env.JIRA_ISSUE_LABEL] - }) - - - - name: Add comment after sync - if: env.JIRA_CREATE_ISSUE_AUTO == 'true' - uses: actions/github-script@v2.0.0 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Internal ticket created : [${{ steps.create_jira_issue.outputs.issue }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create_jira_issue.outputs.issue }})' - }) diff --git a/.github/workflows/create_issue_on_label.yml b/.github/workflows/create_issue_on_label.yml deleted file mode 100644 index de4ab93..0000000 --- a/.github/workflows/create_issue_on_label.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Create issue on Jira when labeled with JIRA_ISSUE_LABEL - -on: - issues: - types: [labeled] - -jobs: - jira: - env: - JIRA_ISSUE_LABEL: ${{ secrets.JIRA_ISSUE_LABEL }} - runs-on: ubuntu-latest - steps: - - - name: Start workflow if GitHub issue is tagged with JIRA_ISSUE_LABEL - if: github.event.label.name == env.JIRA_ISSUE_LABEL - run: echo "Starting workflow" - - - name: Jira Login - if: github.event.label.name == env.JIRA_ISSUE_LABEL - id: login - uses: atlassian/gajira-login@v2.0.0 - env: - JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} - JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} - JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - - name: Jira Create issue - if: github.event.label.name == env.JIRA_ISSUE_LABEL - id: create_jira_issue - uses: atlassian/gajira-create@v2.0.1 - with: - project: ${{ secrets.JIRA_PROJECT }} - issuetype: ${{ secrets.JIRA_ISSUE_TYPE }} - summary: "[GH#${{ github.event.issue.number }}] ${{ github.event.issue.title }}" - description: | - ${{ github.event.issue.body }} - ---- - {panel} - _[Github permalink |${{ github.event.issue.html_url }}]_ - {panel} - - - name: Update Jira issue if JIRA_UPDATE_ISSUE_BODY is defined - if: github.event.label.name == env.JIRA_ISSUE_LABEL && env.JIRA_UPDATE_ISSUE_BODY != '' - env: - JIRA_UPDATE_ISSUE_BODY: ${{ secrets.JIRA_UPDATE_ISSUE_BODY }} - run: > - curl - -u ${{ secrets.JIRA_USER_EMAIL }}:${{ secrets.JIRA_API_TOKEN }} - -X PUT - -H 'Content-Type: application/json' - -d '${{ env.JIRA_UPDATE_ISSUE_BODY }}' - ${{ secrets.JIRA_BASE_URL }}/rest/api/2/issue/${{ steps.create_jira_issue.outputs.issue }} - - - name: Change Title - if: github.event.label.name == env.JIRA_ISSUE_LABEL - uses: actions/github-script@v2.0.0 - env: - JIRA_ISSUE_NUMBER: ${{ steps.create_jira_issue.outputs.issue }} - GITHUB_ORIGINAL_TITLE: ${{ github.event.issue.title }} - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const newTitle = `[${process.env.JIRA_ISSUE_NUMBER}] ${process.env.GITHUB_ORIGINAL_TITLE}` - github.issues.update({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - title: newTitle - }) - - - name: Add comment after sync - if: github.event.label.name == env.JIRA_ISSUE_LABEL - uses: actions/github-script@v2.0.0 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - github.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Internal ticket created : [${{ steps.create_jira_issue.outputs.issue }}](${{ secrets.JIRA_BASE_URL }}/browse/${{ steps.create_jira_issue.outputs.issue }})' - }) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..f055820 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,40 @@ +name: build-release + +on: push + +jobs: + build-test: + runs-on: blacksmith-2vcpu-ubuntu-2204 + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.23.10" + - run: go mod download + - run: go install github.com/jstemmer/go-junit-report/v2@v2.0.0 + - run: make test | go-junit-report >> ${TEST_RESULTS}/go-test-report.xml + - run: make dist + + goreleaser: + runs-on: blacksmith-2vcpu-ubuntu-2204-arm + permissions: + id-token: write + contents: read + needs: build-test + if: startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/checkout@v4 + - run: git config --global --add safe.directory /__w/ccli/ccli + - uses: actions/setup-go@v5 + with: + go-version: "1.23.10" + - uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: release --clean -p 4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CGO_ENABLED: 0 # Required to run on Debian Buster for tutti-blocket deployment diff --git a/LICENSE b/LICENSE index 7db6074..fc5527e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Codacy +Copyright (c) 2025 SMG Swiss Marketplace Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 40accf5..e7e8407 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Helm SSM Plugin -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d3cd080edd8644e085f2f8adfd43510c)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=codacy/helm-ssm&utm_campaign=Badge_Grade) -[![CircleCI](https://circleci.com/gh/codacy/helm-ssm.svg?style=svg)](https://circleci.com/gh/codacy/helm-ssm) This is a **helm3** plugin to help developers inject values coming from AWS SSM parameters, on the `values.yaml` file. It also leverages the wonderful [sprig](http://masterminds.github.io/sprig/) @@ -81,7 +79,7 @@ Choose the latest version from the releases and install the appropriate version for your OS as indicated below. ```sh -$ helm plugin add https://github.com/codacy/helm-ssm +$ helm plugin add https://github.com/tutti-ch/helm-ssm ``` ### Developer (From Source) Install @@ -98,26 +96,6 @@ this is how we recommend doing it. $ make install ``` -## What is Codacy - -[Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews. - -### Among Codacy’s features - -- Identify new Static Analysis issues -- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories) -- Auto-comments on Commits and Pull Requests -- Integrations with Slack, HipChat, Jira, YouTrack -- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories - -Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity. - -Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others. - -## Free for Open Source - -Codacy is free for Open Source projects. - ## License helm-ssm is available under the MIT license. See the LICENSE file for more info. diff --git a/cmd/main.go b/cmd/main.go index e5b1209..6b225fa 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - hssm "github.com/codacy/helm-ssm/internal" + hssm "github.com/tutti-ch/helm-ssm/internal" "github.com/spf13/cobra" ) diff --git a/go.mod b/go.mod index 7858755..a59ecbe 100644 --- a/go.mod +++ b/go.mod @@ -1,23 +1,29 @@ -module github.com/codacy/helm-ssm +module github.com/tutti-ch/helm-ssm -go 1.15 +go 1.23.0 require ( - github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver v1.5.0 // indirect github.com/Masterminds/sprig v2.22.0+incompatible github.com/aws/aws-sdk-go v1.55.5 + github.com/spf13/cobra v1.8.1 + gotest.tools/v3 v3.0.2 +) + +require ( + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver v1.5.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/spf13/cobra v1.8.1 + github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.2.2 // indirect - golang.org/x/crypto v0.32.0 // indirect - gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect + golang.org/x/crypto v0.35.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect - gotest.tools/v3 v3.0.2 ) diff --git a/go.sum b/go.sum index 5006556..4c21022 100644 --- a/go.sum +++ b/go.sum @@ -25,15 +25,10 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -48,75 +43,15 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs= +golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= -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= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/install-binary.sh b/install-binary.sh index 53dfcb3..c44c897 100755 --- a/install-binary.sh +++ b/install-binary.sh @@ -1,10 +1,24 @@ #!/usr/bin/env bash -# Copied from https://github.com/technosophos/helm-template -# Combination of the Glide and Helm scripts, with my own tweaks. +while [ $# -gt 0 ]; do + case "$1" in + --version*|-v*) + if [[ "$1" != *=* ]]; then shift; fi + VERSION="${1#*=}" + ;; + *) + >&2 printf "Error: Invalid argument\n" + exit 1 + ;; + esac + shift +done +if [ -z $VERSION ]; then + VERSION='latest' +fi PROJECT_NAME="helm-ssm" -PROJECT_GH="codacy/$PROJECT_NAME" +PROJECT_GH="tutti-ch/$PROJECT_NAME" eval $(helm env) if [[ $SKIP_BIN_INSTALL == "1" ]]; then @@ -42,7 +56,7 @@ initOS() { # verifySupported checks that the os/arch combination is supported for # binary builds. verifySupported() { - local supported="linux-amd64\nmacos-amd64\nwindows-amd64" + local supported="linux-amd64\nmacos-amd64\nwindows-amd64\linux-arm-armv5\linux-arm-armv6\linux-arm-armv7\linux-arm-arm64" if ! echo "${supported}" | grep -q "${OS}-${ARCH}"; then echo "No prebuild binary for ${OS}-${ARCH}." exit 1 @@ -57,12 +71,15 @@ verifySupported() { # getDownloadURL checks the latest available version. getDownloadURL() { # Use the GitHub API to find the latest version for this project. - local latest_url="https://api.github.com/repos/$PROJECT_GH/releases/latest" - local suffix="$OS.tgz" - if type "curl" > /dev/null; then - DOWNLOAD_URL=$(curl -s $latest_url | grep "$suffix" | awk '/"browser_download_url":/{gsub( /[,"]/,"", $2); print $2}') - elif type "wget" > /dev/null; then - DOWNLOAD_URL=$(wget -q -O - $latest_url | awk '/"browser_download_url":/{gsub( /[,"]/,"", $2); print $2}') + if [ $VERSION = 'latest' ]; then + local latest_url="https://api.github.com/repos/$PROJECT_GH/releases/$VERSION" + if type "curl" > /dev/null; then + DOWNLOAD_URL=$(curl -s $latest_url | sort -r | grep $OS -m3 | awk '/"browser_download_url":/{gsub( /[,"]/,"", $2); print $2}') + elif type "wget" > /dev/null; then + DOWNLOAD_URL=$(wget -q -O - $latest_url | awk '/"browser_download_url":/{gsub( /[,"]/,"", $2); print $2}') + fi + else + DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/$VERSION/helm-ssm-$OS.tgz" fi } @@ -96,7 +113,7 @@ fail_trap() { result=$? if [ "$result" != "0" ]; then echo "Failed to install $PROJECT_NAME" - echo "For support, go to https://github.com/codacy/helm-ssm." + echo "For support, go to https://github.com/tutti-ch/helm-ssm." fi exit $result } diff --git a/plugin.yaml b/plugin.yaml index 2ee27ba..75374ba 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -6,3 +6,6 @@ description: |- ignoreFlags: false useTunnel: false command: "$HELM_PLUGIN_DIR/helm-ssm" +hooks: + install: "$HELM_PLUGIN_DIR/install-binary.sh" + update: "$HELM_PLUGIN_DIR/install-binary.sh"