Skip to content

Commit

Permalink
enhance for flexible download argocd
Browse files Browse the repository at this point in the history
  • Loading branch information
joosangkim committed May 29, 2024
1 parent 7451d32 commit fecbc0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 6 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ name: 'ArgoCD Diff'
description: 'Diffs all ArgoCD apps in the repo, and provides the diff as a PR comment'
author: 'Quizlet'
inputs:
argocd-server-url:
argocd-server-url:
description: ArgoCD server url (without the protocol)
required: true
argocd-token:
argocd-token:
description: ArgoCD token for a local or project-scoped user https://argoproj.github.io/argo-cd/operator-manual/user-management/#local-usersaccounts-v15
required: true
argocd-version:
argocd-version:
description: ArgoCD Version
default: v1.6.1
required: false
github-token:
github-token:
description: Github Token
required: true
argocd-extra-cli-args:
argocd-extra-cli-args:
description: Extra arguments to pass to the argocd CLI
default: --grpc-web
required: false
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'
10 changes: 6 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ interface App {
};
};
}
const ARCH = process.env.ARCH || 'linux';
const PLATFORM = process.platform || 'linux';
const ARCH = process.arch || 'amd64';
const githubToken = core.getInput('github-token');
core.info(githubToken);

Expand Down Expand Up @@ -70,7 +71,8 @@ function scrubSecrets(input: string): string {
async function setupArgoCDCommand(): Promise<(params: string) => Promise<ExecResult>> {
const argoBinaryPath = 'bin/argo';
await tc.downloadTool(
`https://github.com/argoproj/argo-cd/releases/download/${VERSION}/argocd-${ARCH}-amd64`,
// https://github.com/argoproj/argo-cd/releases/download/v2.11.2/argocd-linux-amd64
`https://github.com/argoproj/argo-cd/releases/download/${VERSION}/argocd-${PLATFORM}-${ARCH}`,
argoBinaryPath
);
fs.chmodSync(path.join(argoBinaryPath), '755');
Expand Down Expand Up @@ -120,8 +122,8 @@ async function postDiffComment(diffs: Diff[]): Promise<void> {
const shortCommitSha = String(sha).substr(0, 7);

const diffOutput = diffs.map(
({ app, diff, error }) => `
App: [\`${app.metadata.name}\`](https://${ARGOCD_SERVER_URL}/applications/${app.metadata.name})
({ app, diff, error }) => `
App: [\`${app.metadata.name}\`](https://${ARGOCD_SERVER_URL}/applications/${app.metadata.name})
YAML generation: ${error ? ' Error 🛑' : 'Success 🟢'}
App sync status: ${app.status.sync.status === 'Synced' ? 'Synced ✅' : 'Out of Sync ⚠️ '}
${error
Expand Down

0 comments on commit fecbc0b

Please sign in to comment.