Code Monkey home page Code Monkey logo

argo-cd-action's Introduction

argo-cd

argo-cd-action

Strict TypeScript Commitizen friendly Known Vulnerabilities

integration test

GitHub action for executing Argo CD ๐Ÿฆ‘

Usage

See the ArgoCD CLI documentation for the list of available commands and options.

- uses: clowdhaus/argo-cd-action/@main
  with:
    version: 2.6.7
    command: version
    options: --client

With GitHub API authentication

If you are running a lot of workflows/jobs quite frequently, you may run into GitHub's API rate limit due to pulling the CLI from the ArgoCD repository. To get around this limitation, add the GITHUB_TOKEN as shown below (or see here for more examples) to utilize a higher rate limit when authenticated.

- uses: clowdhaus/argo-cd-action/@main
  env:
    # Only required for first step in job where API is called
    # All subsequent setps in a job will not re-download the CLI
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  with:
    command: version
    options: --client
- uses: clowdhaus/argo-cd-action/@main
  # CLI has already been downloaded in prior step, no call to GitHub API
  with:
    command: version
    options: --client

Getting Started

The following instructions will help you get setup for development and testing purposes.

Prerequisites

yarn is used to handle dependencies and executing scripts on the codebase.

See here for instructions on installing yarn on your local machine.

Once you have installed yarn, you can install the project dependencies by running the following command from within the project root directory:

  $ yarn

Contributing

Please read CODE_OF_CONDUCT.md for details on our code of conduct and the process for submitting pull requests.

Changelog

Please see the CHANGELOG.md for details on individual releases.

argo-cd-action's People

Contributors

bryantbiggs avatar cruizen avatar semantic-release-bot avatar tutte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

argo-cd-action's Issues

Support downloading artifact directly from Argo

Describe the solution you'd like
ArgoCD self-hosts artifacts for the CLI on it's web server. As a user, I'd like to be able to configure this action to download whatever version my self-hosted Argo is currently providing, for a few reasons:

  • To keep my CD instance and the CLI in-sync automatically
  • To avoid GH rate limiting when downloading artifacts

Cannot generate ApplicationSets

I have a Github Actions workflow set up that creates an appset as described in the documentation: https://argo-cd.readthedocs.io/en/stable/user-guide/commands/argocd_appset/

When I run my workflow, I see this step fails

      - name: "Create AppSet"
        uses: clowdhaus/argo-cd-action/@main
        env:
          ARGOCD_SERVER: some.server
        with:
          command: appset create app.yaml

with this error description:

/opt/hostedtoolcache/argocd/2.6.7/x64/argocd appset create app.yaml
time="2023-08-02T20:42:08Z" level=fatal msg="rpc error: code = Unimplemented desc = unknown service applicationset.ApplicationSetService"
Error: The process '/opt/hostedtoolcache/argocd/2.6.7/x64/argocd' failed with exit code 20

unknown service applicationset.ApplicationSetService sounds like ArgoCD AppSets are not supported, is that correct?

Patching quote problem

Hello im trying to use this action for patching a resource and is not working , i tried with many options out there and always remove the simple quote '

    - name: Replacing..
      run: |
        CMD="patch-resource apps-account-activation-frontend-${{github.event.inputs.Environment}} --kind ${{github.event.inputs.Type}} --patch '{"spec": {"replicas": ${{github.event.inputs.UpDownScale}}}}'"
        echo $CMD
        echo "CMD="patch-resource apps-account-activation-frontend-${{github.event.inputs.Environment}} --kind ${{github.event.inputs.Type}} --patch '{"spec": {"replicas": ${{github.event.inputs.UpDownScale}}}}'"" >> $GITHUB_ENV
        
    - uses: clowdhaus/argo-cd-action/@main
      name: ArgoCd Scale to ${{github.event.inputs.UpDownScale}} 
      with:
        command: app
        options: '${{env.CMD}}'

output

/home/runner/_work/_tool/argocd/2.3.3/x64/argocd app patch-resource apps-account-activation-frontend-qa5 --kind Deployment --patch {"spec": {"replicas": 2}}
Patch resource in an application

The `set-output` command is deprecated and will be disabled soon.

Describe the bug
The set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files.

To Reproduce

- name: Login to ArgoCD
   uses: clowdhaus/argo-cd-action/@main
   with:
     version: ${{ env.ARGOCD_VERSION }}
     command: login
     options: >-
       ${{ secrets.ARGOCD_URL }}
        --username ${{ secrets.ARGOCD_USERNAME }}
        --password ${{ secrets.ARGOCD_PASSWORD }}
        --grpc-web

It seems to be

core.setOutput('output', result);

Expected behavior
No warnings when using the action

Additional context
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

actions/toolkit#1218
actions/toolkit#1178

argo-cd-action/v1.17.0 gets stuck indefinitely at App Sync stage

Describe the bug
A clear and concise description of what the bug is.
Using argo-cd-action/v1.15.0, argo-cd-action/v1.17.0, ArgoCD workflow gets stuck at App Sync stage indefinitely.
ArgoCD server version: v2.5.1+504da42

To Reproduce
Steps to reproduce the behavior:

  • name: Argocd app sync
    uses: clowdhaus/argo-cd-action/@v1.17.0
    with:
    version: 2.5.1
    command: app sync ${{ env.PARENT_APP_NAME }} -l argocd.argoproj.io/instance=${{ env.PARENT_APP_NAME }}
    options: --auth-token=${{ secrets.ARGOCD_AUTH_TOKEN }} --server ${{ env.ARGOCD_SERVER }}

Add support for arm64

Problem

The ArgoCD cli CPU architecture is hardcoded to amd64.
It is not possible to use other architectures although the official CLI is also built for them.

Proposed solution

Take into consideration the CPU architecture of the runner when fetching the argocd binary.

image

After upgrading to 1.5.0 version backward compatibility is gone

Describe the bug
We were using clowdhaus/argo-cd-action/@main for GHA but today our pipelines started to fail - we use node
They work fine for v1.4.2 version but we are using nodejs in version 12.

Expected behavior
Should be backward compatible/breaking changes should be annoucned.

Additional context
NodeJS 12 & 14

Security: Can the checksum/SLSA provenance of the downloaded ArgoCD cli be verified?

Is your feature request related to a problem? Please describe.
Supply chain injections are becoming a common security flaw in CI systems and build chains. This includes:

  • squatting in typo-named repos
  • where CI tools can be compromised, pushing tags/releases that masquerade as official ones
  • where repos have been renamed, or changed ownership, squatting in a previous repository name

Describe the solution you'd like

ArgoCD provides multiple mechanisms to validate the authenticity of the download, with SLSA and weaker SHA256 checksums available. Using one of these to verify the provenance of the intended version improves the integrity of using the dependancy.

This would be in the code to download ArgoCD for use by this action.

Using the SLSA method is preferred as it is more secure.

Describe alternatives you've considered
Using the simpler SHA256 mechanism. Performing these actions without using this repository.

Additional context
Add any other context or screenshots about the feature request here.

Fails to find argocd on subsequent runs

Describe the bug
When I first introduced this action it worked fine. However on subsequent runs it fails. I'm using a self-hosted runner without a specific clean-up step.

To Reproduce
Steps to reproduce the behavior:

  1. Create a workflow with this action
  2. Run it and see it works
  3. Run it again and it will fail with
Unexpected error attempting to determine if executable file exists '/home/github/_work/_tool/argocd/2.0.0/x64/argocd/argocd': Error: ENOTDIR: not a directory, stat '/home/github/_work/_tool/argocd/2.0.0/x64/argocd/argocd'
Error: Unable to locate executable file: argocd. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

Expected behavior
I expected the action to be succesful every time.

Additional context
The argocd file is located /home/github/_work/_tool/argocd/2.0.0/x64/argocd, so the mechanism to find already downloaded executable is searching with a path that is too long.

Error: Destination file path /home/actions/argocd already exists

Describe the bug
When running argo-cd-action on a custom runner, steps fail if the /home/actions/argocd directory already exists

To Reproduce
Steps to reproduce the behavior:

  1. Add [email protected] to a project that uses a custom runner and has previously used argo-cd-action v1.12.1
  2. Run an argocd command
  3. Get an error. that the /home/actions/argocd directory already exists

Debug Log

##[debug][index] command: app,sync,foo,-l,argocd.argoproj.io/instance=bar
##[debug][index] options: --auth-token=***
##[debug][index] version: 2.8.4
##[debug]isExplicit: 2.8.4
##[debug]explicit? true
##[debug]checking cache: /home/actions/_work/_tool/argocd/2.8.4/x64
##[debug]not found
##[debug]Unable to find "argocd" executable, downloading it now
##[debug][debug()] getExecutableUrl: https://github.com/argoproj/argo-cd/releases/download/v2.8.4/argocd-linux-amd64
##[debug]Downloading https://github.com/argoproj/argo-cd/releases/download/v2.8.4/argocd-linux-amd64
##[debug]Destination /home/actions/argocd
Destination file path /home/actions/argocd already exists
Waiting 16 seconds before trying again
Destination file path /home/actions/argocd already exists
Waiting 17 seconds before trying again
Error: Destination file path /home/actions/argocd already exists

v1.9.0 fails to run

Describe the bug
v1.9.0 fails to run.

Our workflow is set up like the documentation instructs instruct: uses: clowdhaus/argo-cd-action@main, which will use latest version. However the workflow startet to fail today, and I can see that v1.9.0 was released yesterday.

Run clowdhaus/argo-cd-action@main
Destination file path /home/github/argocd already exists
Waiting 17 seconds before trying again
Destination file path /home/github/argocd already exists
Waiting 16 seconds before trying again
Error: Destination file path /home/github/argocd already exists

To Reproduce
Steps to reproduce the behavior:

  1. set up a workflow that uses this action
  2. run it multiple times and it should fail on subsequent runs

Expected behavior
The script will execute as usual, without errors

Screenshots
image

Additional context
Running as a github runner on a selfhosted runner using https://github.com/SanderKnape/github-runner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.