Skip to content

Commit

Permalink
feat: add arm binary (#840)
Browse files Browse the repository at this point in the history
## What

## Why

## Notes

---------

Co-authored-by: yaroslav-codefresh <yaroslav@codefresh.io>
  • Loading branch information
mikhail-klimko and yaroslav-codefresh authored Aug 30, 2023
1 parent a3dbb12 commit e1961c8
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 22 deletions.
40 changes: 40 additions & 0 deletions __mocks__/codefresh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# More examples of Codefresh YAML can be found at
# https://codefresh.io/docs/docs/yaml-examples/examples/

version: "1.0"
# Stages can help you organize your steps in stages
stages:
- "clone"
- "build"
- "test"

steps:
clone:
title: "Cloning repository"
type: "git-clone"
repo: "https://github.com/codefresh-io/cli/"
# Clone the master branch. Or, use ${{CF_BRANCH}} to get branch name from trigger
# Learn more at https://codefresh.io/docs/docs/codefresh-yaml/variables/
revision: "master"
stage: "clone"

build:
title: "Building Docker image"
type: "build"
image_name: "codefresh-io/cli"
working_directory: "${{clone}}"
# Set 'latest' tag on the image. Or, use built-in variables
# like ${{CF_BRANCH_TAG_NORMALIZED}} to use the current branch name/tag.
tag: "latest"
dockerfile: "Dockerfile"
stage: "build"

test:
title: "Running test"
type: "freestyle" # Run any command
image: "ubuntu:latest" # The image in which command will be executed
working_directory: "${{clone}}" # Running command where code cloned
commands:
- "ls"
stage: "test"

37 changes: 19 additions & 18 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ const ALLOW_BETA_COMMANDS = process.env.ALLOW_BETA_COMMANDS;
const categoriesOrder = {
completion: 30,
authentication: 31,
'operate on resources' : 32,
pipelines : 40,
'pipelines v2 (beta)' : 42,
projects : 45,
'operate on resources': 32,
pipelines: 40,
'pipelines v2 (beta)': 42,
projects: 45,
builds: 50,
contexts : 70 ,
images : 80 ,
triggers : 90,
environments : 100 ,
compositions : 110 ,
'helm repos' : 111 ,
contexts: 70,
images: 80,
triggers: 90,
environments: 100,
compositions: 110,
'helm repos': 111,
'predefined pipelines': 120,
'cli config': 121,
teams: 130,
more : 150,
more: 150,
};


Expand Down Expand Up @@ -115,7 +115,7 @@ const getWeight = async (command) => {
}
};

const createCommandFile = async (nestedCategory,command) => {
const createCommandFile = async (nestedCategory, command) => {
const docs = command.prepareDocs();
const dir = path.resolve(baseDir, `${(nestedCategory || 'undefined').toLowerCase()}`);

Expand Down Expand Up @@ -216,7 +216,7 @@ const createCategoryFile = async (content, category) => {
* updates the category main file with a specific command
* possible extensions are: HEADER, COMMANDS
*/
const updateCategoryFileArray = async (nestedCategory,command, existingContent) => {
const updateCategoryFileArray = async (nestedCategory, command, existingContent) => {
const docs = command.prepareDocs();
const { category } = docs;
const finalCategoryArr = existingContent || {};
Expand Down Expand Up @@ -253,7 +253,7 @@ const updateCategoryFileArray = async (nestedCategory,command, existingContent)
finalCategoryArr.category = category;
newCmd.weight = await getWeight(command);
newCmd.content = commandString;
if (!finalCategoryArr.commands){
if (!finalCategoryArr.commands) {
finalCategoryArr.commands = [];

}
Expand Down Expand Up @@ -318,16 +318,16 @@ const createAutomatedDocs = async () => {

// document only in case category field exists and there are no sub commands under it
const docs = command.prepareDocs();
const {category} = docs;
const { category } = docs;
if (!category || await hasSubCommands(command)) {
continue;
}

nestedCategories[category] = await getNestedCategories(command);
const nestedCategory = nestedCategories[category];
categories[category] = await updateCategoryFileArray(nestedCategory,command, categories[category]);
categories[category] = await updateCategoryFileArray(nestedCategory, command, categories[category]);
await upsertCategoryFolder(nestedCategory);
await createCommandFile(nestedCategory,command);
await createCommandFile(nestedCategory, command);
}

let categoriesFinalContent = {};
Expand Down Expand Up @@ -356,7 +356,7 @@ const createDownloadPage = async () => {
links.push(asset.browser_download_url);
}));
const commandFilePath = path.resolve(baseDir, './installation/download.md');
const finalContent=
const finalContent =
'+++\n' +
'title = "Download"\n' +
'description = "asd"\n' +
Expand All @@ -372,6 +372,7 @@ const createDownloadPage = async () => {
' <li><a href=' + links[1] + ' target="_blank">Linux-x64</a></li>\n' +
' <li><a href=' + links[2] + ' target="_blank">Macos-x64</a></li>\n' +
' <li><a href=' + links[3] + ' target="_blank">Windows-x64</a></li>\n' +
' <li><a href=' + links[4] + ' target="_blank">Alpine-arm64</a></li>\n' +
'</ul> \n' +
'\n' +
'After downloading the binary, untar or unzip it and your are good to go.<br>\n' +
Expand Down
2 changes: 1 addition & 1 deletion lib/interface/cli/commands/root/root.sdk.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('root commands', () => {
describe('Not valid yaml ', async () => {
it('should throw error for not valid file', async () => {
const argv = {
filenames: ['./codefresh.yml'],
filenames: ['./__mocks__/codefresh.yml'],
};
const result = await validateCmd.handler(argv)
.catch(err => err);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.85.1",
"version": "0.86.0",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand All @@ -9,7 +9,7 @@
"test": "jest .spec.js --coverage",
"e2e": "bash e2e/e2e.spec.sh",
"eslint": "eslint --fix lib/logic/**",
"pkg": "pkg . -t node16-alpine-x64,node16-macos-x64,node16-linux-x64,node16-win-x64 --out-path ./dist",
"pkg": "pkg . -t node16-alpine-x64,node16-macos-x64,node16-linux-x64,node16-win-x64,node16-linux-arm64 --out-path ./dist",
"serve-docs": "yarn build-local-docs && cd temp && hugo server -D",
"serve-docs-beta": "ALLOW_BETA_COMMANDS=true yarn build-local-docs && cd temp && hugo server -D",
"build-local-docs": "node ./docs/index.js",
Expand Down Expand Up @@ -115,4 +115,4 @@
"./test-setup.js"
]
}
}
}

0 comments on commit e1961c8

Please sign in to comment.