Skip to content

feat: add arm binary #840

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

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
]
}
}
}