Skip to content

Cr 15885 split base #769

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 21 commits into from
Dec 14, 2022
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 Dockerfile-debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# go hub binary
FROM golang:alpine as go
RUN apk --update add ca-certificates git
RUN go install github.com/github/hub@latest

# python yq binary
FROM six8/pyinstaller-alpine:alpine-3.6-pyinstaller-v3.4 as yq
ARG YQ_VERSION=2.10.0
ENV PATH="/pyinstaller:$PATH"
RUN pip install yq==${YQ_VERSION}
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)

# Main
FROM node:18.12.1-bullseye-slim

RUN apt update
RUN apt -y install ca-certificates git curl bash jq busybox && ln -s /bin/busybox /usr/bin/[[

COPY --from=go /go/bin/hub /usr/local/bin/hub
COPY --from=yq /tmp/yq /usr/local/bin/yq

WORKDIR /cf-cli

COPY package.json /cf-cli
COPY yarn.lock /cf-cli
COPY check-version.js /cf-cli
COPY run-check-version.js /cf-cli

RUN yarn install --prod --frozen-lockfile && \
yarn cache clean

COPY . /cf-cli

RUN yarn generate-completion

RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh

RUN codefresh components update --location components

ENTRYPOINT ["codefresh"]
80 changes: 65 additions & 15 deletions codefresh-arm.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: "1.0"
steps:
steps:
main_clone:
title: 'Cloning main repository...'
type: git-clone
Expand All @@ -8,18 +8,31 @@ steps:
git: ${{GIT_CONTEXT}}

build_image:
title: "Building the image..."
type: build
working_directory: ${{WORKDIR}}
disable_push: true
dockerfile: ./Dockerfile
image_name: ${{IMAGE_NAME}}
tag: ${{CF_SHORT_REVISION}}
type: parallel
steps:

push_dev:
build_image_alpine:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

title: "Building the alpine image..."
type: build
working_directory: ${{WORKDIR}}
disable_push: true
dockerfile: ./Dockerfile
image_name: ${{IMAGE_NAME}}
tag: ${{CF_SHORT_REVISION}}

build_image_debian:
title: "Building the debian image..."
type: build
working_directory: ${{WORKDIR}}
disable_push: true
dockerfile: ./Dockerfile-debian
image_name: ${{IMAGE_NAME}}
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}

push_dev_alpine:
type: push
candidate: ${{build_image}}
title: "Pushing image to registry with revision tag"
candidate: ${{build_image_alpine}}
title: "Pushing alpine image to registry with revision tag"
tag: ${{CF_SHORT_REVISION}}${{ARM_TAG_POSTFIX}}
scale:
push_quay_dev:
Expand All @@ -32,10 +45,26 @@ steps:
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
title: "Pushing image to gcr.io registry with revision tag"

push_master:
push_dev_debian:
type: push
candidate: ${{build_image}}
title: "Pushing image with release tag"
candidate: ${{build_image_debian}}
title: "Pushing debian image to registry with revision tag"
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
scale:
push_quay_dev_debian:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
title: "Pushing image to quay.io registry with revision tag"
push_dockerhub_dev_debian:
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
title: "Pushing image to dockerhub registry with revision tag"
push_gcr_enterprise_dev_debian:
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
title: "Pushing image to gcr.io registry with revision tag"

push_master_alpine:
type: push
candidate: ${{build_image_alpine}}
title: "Pushing alpine image with release tag"
when:
branch:
only: [ master ]
Expand All @@ -45,10 +74,31 @@ steps:
scale:
push_quay_prod:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
title: "Pushing image to quay.io registry with release tag"
title: "Pushing alpine image to quay.io registry with release tag"
push_dockerhub_prod:
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
title: "Pushing image to dockerhub registry with release tag"
push_gcr_enterprise_prod:
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
title: "Pushing image to gcr.io registry with release tag"

push_master_debian:
type: push
candidate: ${{build_image_debian}}
title: "Pushing debian image with release tag"
when:
branch:
only: [ master ]
tags:
- "${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
- "latest${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
scale:
push_quay_prod_debian:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
title: "Pushing image to quay.io registry with release tag"
push_dockerhub_prod_debian:
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
title: "Pushing image to dockerhub registry with release tag"
push_gcr_enterprise_prod_debian:
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
title: "Pushing image to gcr.io registry with release tag"
42 changes: 38 additions & 4 deletions codefresh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ steps:
- success

# in case the candidate image will not be found the release flow will crash and this means that the build pipelines has failed
push_step:
push_step_alpine:
stage: docker
type: push
title: "Push release image"
title: "Push alpine release image"
image_name: codefresh/cli
tags:
- ${{PACKAGE_VERSION}}
Expand All @@ -98,6 +98,32 @@ steps:
on:
- success

push_step_debian:
stage: docker
type: push
title: "Push debian release image"
image_name: codefresh/cli
tags:
- ${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}
- latest${{DEBIAN_TAG_POSTFIX}}
scale:
push_to_dockerhub:
registry: dockerhub
title: "push to dockerhub"
candidate: codefresh/cli:${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
push_to_gcr:
title: "push to gcr"
candidate: gcr.io/codefresh-inc/codefresh/cli:${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
push_to_quay:
registry: cf-quay
title: "push to quay.io"
candidate: quay.io/codefresh/cli:${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
when:
steps:
- name: extract_version
on:
- success

create_manifest_list:
stage: docker
type: "codefresh-inc/multiarch-manifester"
Expand All @@ -117,14 +143,22 @@ steps:
username: '${{GCR_CODEFRESH_INC_USERNAME}}'
password: '${{GCR_CODEFRESH_INC_PASSWORD}}'
scale:
master_branch_tags:
master_branch_tags_alpine:
arguments:
tags:
- ${{PACKAGE_VERSION}}
- latest
master_branch_tags_debian:
arguments:
tags:
- ${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}
- latest${{DEBIAN_TAG_POSTFIX}}
when:
steps:
- name: push_step
- name: push_step_alpine
on:
- success
- name: push_step_debian
on:
- success

Expand Down
36 changes: 33 additions & 3 deletions codefresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,18 @@ steps:
type: parallel
steps:

build_step:
build_step_alpine:
type: build
dockerfile: Dockerfile
image-name: codefresh/cli
tag: ${{CF_BRANCH_TAG_NORMALIZED}}

build_step_debian:
type: build
dockerfile: Dockerfile-debian
image-name: codefresh/cli
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}

run_arm_build:
type: codefresh-run
arguments:
Expand All @@ -99,12 +105,13 @@ steps:
- IMAGE_NAME=codefresh/cli
- WORKDIR=${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}
- ARM_TAG_POSTFIX="${{ARM_TAG_POSTFIX}}"
- DEBIAN_TAG_POSTFIX="${{DEBIAN_TAG_POSTFIX}}"
- PACKAGE_VERSION=${{PACKAGE_VERSION}}

push_step:
push_step_alpine:
type: push
tag: '${{CF_SHORT_REVISION}}'
candidate: ${{build_step}}
candidate: ${{build_step_alpine}}
scale:
push_to_dockerhub:
registry: dockerhub
Expand All @@ -115,6 +122,20 @@ steps:
registry: cf-quay
title: "push to quay.io"

push_step_debian:
type: push
tag: '${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}'
candidate: ${{build_step_debian}}
scale:
push_to_dockerhub_debian:
registry: dockerhub
title: "push to dockerhub"
push_to_gcr_debian:
title: "push to gcr"
push_to_quay_debian:
registry: cf-quay
title: "push to quay.io"

create_manifest_list:
type: "codefresh-inc/multiarch-manifester"
arguments:
Expand All @@ -140,6 +161,13 @@ steps:
arguments:
tags:
- ${{CF_SHORT_REVISION}}
dev_branches_tags_debian:
when:
branch:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}

fail_on_bad_version:
image: codefresh/build-cli
Expand All @@ -159,6 +187,8 @@ steps:
BRANCH: master
VARIABLE:
- PACKAGE_VERSION=${{PACKAGE_VERSION}}
- ARM_TAG_POSTFIX="${{ARM_TAG_POSTFIX}}"
- DEBIAN_TAG_POSTFIX="${{DEBIAN_TAG_POSTFIX}}"
when:
branch:
only: [ master ]
Expand Down
4 changes: 2 additions & 2 deletions lib/interface/cli/completion/completion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ jest.mock('fs', () => {
}
};
return Object.assign(jest.requireActual('fs'), {
lstat: (p, options, callback) => callback(null, lstatSync(p)),
stat: (p, options, callback) => callback(null, lstatSync(p)),
lstat: (p, callback) => callback(null, lstatSync(p)),
stat: (p, callback) => callback(null, lstatSync(p)),
access: (path, c) => c(null, true),
readdirSync,
existsSync,
Expand Down