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

Feature Request: introduces a "setup" mode to download the CLI (latest or specified version) instead of using docker image #76

Closed
dduportal opened this issue Apr 15, 2022 · 7 comments

Comments

@dduportal
Copy link
Contributor

Is your feature request related to a problem?

The actual action which uses the updatecli Docker images is not really convenient to use:

  • Its version scheme is not the updatecli's version scheme. It's necessary (updatecli is a dependency of the action), but it's not easy to check which version of updatecli is used
  • Most of the time, the Docker image does not have the expected CLI tools required for our processes.
  • Sometimes, Docker Engine is not available on some custom runners (not my case by it happens if you execute GH runners as pods in a Kubernetes cluster for instance)

Solution you'd like

A "setup" mode would solve all this problems, a bit like other actions such as https://github.com/Azure/setup-helm or https://github.com/actions/setup-java.

- name: Setup and run updatecli (latest) with Docker image - current use case
  uses: updatecli/updatecli-action@v2
  with:
      useDocker: true # false by default - BREAKING CHANGE (hence the v2)
      command: "diff --config updatecli.d --values values.yaml"
  env:
      UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup and run updatecli with specific version (CLI by default)
  uses: updatecli/updatecli-action@v2
  with:
      version: 0.23.2
- name: Run updatecli diff
   run: |
     updatecli diff --config updatecli.d --values values.yaml
   env:
      UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run updatecli apply
   run: |
     updatecli apply --config updatecli.d --values values.yaml
   env:
      UPDATECLI_GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }}
  • We could also specify the CPU arch and the OS as additional parameters

Alternatives you've considered

  • curl -sSLO && chmod a+x in pur shell

Anything else?

No response

@olblak
Copy link
Member

olblak commented May 20, 2022

I created a new branch "v2" that switch from a Docker Github action to a Javascript Github Action.
It introduces three major changes:

  1. Introduce the install mode that installs updatecli. The version can be specified using the parameter version. Please not that I didn't implement the "latest" version. While that would a nice improvement, I am not familiar enough with Javascript to spend more time on this.
  2. I deprecate parameters command and flags in favor of args. I realized that I never used the parameters flags
  3. The default updatecli run is updatecli diff and not anymore updatecli apply

You can see what changed by looking at:

https://github.com/updatecli/updatecli-action/compare/main..v2?expand=1

Please note that the content of the directory dist is generated and my "contribution" is done in index.js and readme.md

@olblak
Copy link
Member

olblak commented May 20, 2022

- name: Setup and run updatecli (latest) with Docker image - current use case
  uses: updatecli/updatecli-action@v2
  with:
      useDocker: true # false by default - BREAKING CHANGE (hence the v2)
      command: "diff --config updatecli.d --values values.yaml"
  env:
      UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

If we really want to use the docker github action then I would just keep maintaining the branch v1

@olblak
Copy link
Member

olblak commented May 20, 2022

- name: Setup and run updatecli with specific version (CLI by default)
  uses: updatecli/updatecli-action@v2
  with:
      version: 0.23.2
- name: Run updatecli diff
   run: |
     updatecli diff --config updatecli.d --values values.yaml
   env:
      UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I now realize that I didn't follow this interface but instead went with

      - name: Install Updatecli in local cache
        uses: updatecli/updatecli-action@v2
        with:
          install-only: true

      - name: Diff
        uses: updatecli/updatecli-action@v2
        env:
          UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Apply
        uses: updatecli/updatecli-action@v2
        with:
          arg: apply --config updatecli/updatecli.d
        env:
          UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Run Updatecli using local binary
        run: "updatecli diff --config ./updatecli/updatecli.d"
        env:
          UPDATECLI_GITHUB_ACTOR: ${{ github.actor }}
          UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I am open to feedback but I think @dduportal suggestion is better as it makes it more obvious that the binary is available on the runner and that we are not using a docker container

@olblak
Copy link
Member

olblak commented May 20, 2022

I am now wondering if I shouldn't just take care of downloading the binary and stick to

      - name: Install Updatecli in local cache
        uses: updatecli/updatecli-action@v2
        with:
          version: v0.2.5.0 # Optional parameter

      - name: Run Updatecli using local binary
        run: "updatecli diff --config ./updatecli/updatecli.d"
        env:
          UPDATECLI_GITHUB_ACTOR: ${{ github.actor }}
          UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@dduportal
Copy link
Contributor Author

I am now wondering if I shouldn't just take care of downloading the binary and stick to

      - name: Install Updatecli in local cache
        uses: updatecli/updatecli-action@v2
        with:
          version: v0.2.5.0 # Optional parameter

      - name: Run Updatecli using local binary
        run: "updatecli diff --config ./updatecli/updatecli.d"
        env:
          UPDATECLI_GITHUB_ACTOR: ${{ github.actor }}
          UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

absolutely! That is the intent of my initial proposal, to focus on the important part: "getting updatecli with the correct version (CPU arch + OS) installed in the PATH"

@olblak
Copy link
Member

olblak commented May 20, 2022

Right final version before a v2.0.0

@olblak
Copy link
Member

olblak commented May 23, 2022

Ready to be used
https://github.com/updatecli/updatecli-action/releases/tag/v2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants