Skip to content

Commit

Permalink
Add ARM support (#608)
Browse files Browse the repository at this point in the history
* Update Dockerfile

* Added arm build

* Fix stage

* Fix pipeline run step

* Added manifests to pipeline

* Fix push step

* Updated gcr creds

* Added test step

* Added test step

* Removed test step

* Added test step

* Removed test step

* Override gcr registry

* Update release pipeline

* Bump version

* Added codefresh-arm.yml

* Update pipelines

* Update trigger name

* Added titles
  • Loading branch information
palson-cf authored Dec 14, 2020
1 parent 8e1543f commit 89b33ae
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 34 deletions.
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@ RUN pip install yq==${YQ_VERSION}
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)

# Main
FROM codefresh/node:10.15.3-alpine3.11
FROM node:10.23.0-alpine3.11

RUN apk --update add --no-cache ca-certificates git curl bash yarn
RUN apk --update add --no-cache ca-certificates git curl bash yarn jq=1.6-r0

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

ARG JQ_VERSION=1.6

RUN wget -O /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 && \
chmod +x /usr/local/bin/*

WORKDIR /cf-cli

COPY package.json /cf-cli
Expand Down
54 changes: 54 additions & 0 deletions codefresh-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: "1.0"
steps:
main_clone:
title: 'Cloning main repository...'
type: git-clone
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}
revision: ${{CF_REVISION}}
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}}

push_dev:
type: push
candidate: ${{build_image}}
title: "Pushing image to registry with revision tag"
tag: ${{CF_SHORT_REVISION}}${{ARM_TAG_POSTFIX}}
scale:
push_quay_dev:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
title: "Pushing image to quay.io registry with revision tag"
push_dockerhub_dev:
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
title: "Pushing image to dockerhub registry with revision tag"
push_gcr_enterprise_dev:
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
title: "Pushing image to gcr.io registry with revision tag"

push_master:
type: push
candidate: ${{build_image}}
title: "Pushing image with release tag"
when:
branch:
only: [ master ]
tags:
- "${{PACKAGE_VERSION}}${{ARM_TAG_POSTFIX}}"
- "latest${{ARM_TAG_POSTFIX}}"
scale:
push_quay_prod:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
title: "Pushing 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"
53 changes: 40 additions & 13 deletions codefresh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,48 @@ steps:
- "cf_export PACKAGE_VERSION"

# in case the candidate image will not be found the release flow will crash and this means that the build pipelines has failed
push_to_registry_version:
title: "Update dockerhub image version tag"
push_step:
type: push
candidate: gcr.io/codefresh-inc/codefresh/cli:${{CF_SHORT_REVISION}}
image_name: codefresh/cli
tag: ${{PACKAGE_VERSION}}
registry: dockerhub
title: "Push release image"
tags:
- ${{PACKAGE_VERSION}}
- latest
scale:
push_to_dockerhub:
registry: dockerhub
title: "push to dockerhub"
candidate: codefresh/cli:${{CF_SHORT_REVISION}}
push_to_gcr:
title: "push to gcr"
candidate: gcr.io/codefresh-inc/codefresh/cli:${{CF_SHORT_REVISION}}
push_to_quay:
registry: cf-quay
title: "push to quay.io"
candidate: quay.io/codefresh/codefresh/cli:${{CF_SHORT_REVISION}}

push_to_registry_latest:
title: "Update dockerhub image latest tag"
type: push
candidate: gcr.io/codefresh-inc/codefresh/cli:${{CF_SHORT_REVISION}}
image_name: codefresh/cli
tag: latest
registry: dockerhub
create_manifest_list:
type: "codefresh-inc/multiarch-manifester"
arguments:
image_name: codefresh/cli
arch_tag_postfixes:
arm64: "${{ARM_TAG_POSTFIX}}"
registries:
- name: 'quay.io'
username: '${{QUAY_USERNAME}}'
password: '${{QUAY_PASSWORD}}'
- name: 'docker.io'
username: '${{DOCKERHUB_USERNAME}}'
password: '${{DOCKERHUB_PASSWORD}}'
- name: 'gcr.io'
path_prefix: codefresh-inc
username: '${{GCR_CODEFRESH_INC_USERNAME}}'
password: '${{GCR_CODEFRESH_INC_PASSWORD}}'
scale:
master_branch_tags:
arguments:
tags:
- ${{PACKAGE_VERSION}}
- latest

generate_comletion:
title: "Generating commands completion tree"
Expand Down
87 changes: 74 additions & 13 deletions codefresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,42 @@ steps:
commands:
- yarn test

build_step:
type: build
dockerfile: Dockerfile
image-name: codefresh/cli
tag: ${{CF_BRANCH_TAG_NORMALIZED}}
extract_version:
title: "Exporting package.json version"
image: codefresh/build-cli
commands:
- 'export PACKAGE_VERSION=$(jq -r ".version" package.json)'
- "echo Current version: $PACKAGE_VERSION"
- "cf_export PACKAGE_VERSION"

build_images:
type: parallel
steps:

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

run_arm_build:
type: codefresh-run
arguments:
PIPELINE_ID: 'codefresh-io/cli/build-arm'
TRIGGER_ID: codefresh-io/cli
BRANCH: ${{CF_BRANCH}}
DETACH: false
VARIABLE:
- CF_REPO_OWNER=${{CF_REPO_OWNER}}
- CF_REPO_NAME=${{CF_REPO_NAME}}
- CF_REVISION=${{CF_REVISION}}
- CF_BRANCH=${{CF_BRANCH}}
- CF_SHORT_REVISION=${{CF_SHORT_REVISION}}
- GIT_CONTEXT=cf_github
- IMAGE_NAME=codefresh/cli
- WORKDIR=${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}
- ARM_TAG_POSTFIX="${{ARM_TAG_POSTFIX}}"
- PACKAGE_VERSION=${{PACKAGE_VERSION}}

push_step:
type: push
Expand All @@ -41,19 +72,49 @@ steps:
scale:
push_to_dockerhub:
registry: dockerhub
title: "push to dockerhub"
title: "push to dockerhub"
push_to_gcr:
title: "push to gcr"
title: "push to gcr"
push_to_quay:
registry: cf-quay
title: "push to quay.io"

create_manifest_list:
type: "codefresh-inc/multiarch-manifester"
arguments:
image_name: codefresh/cli
arch_tag_postfixes:
arm64: "${{ARM_TAG_POSTFIX}}"
registries:
- name: 'quay.io'
username: '${{QUAY_USERNAME}}'
password: '${{QUAY_PASSWORD}}'
- name: 'docker.io'
username: '${{DOCKERHUB_USERNAME}}'
password: '${{DOCKERHUB_PASSWORD}}'
- name: 'gcr.io'
path_prefix: codefresh-inc
username: '${{GCR_CODEFRESH_INC_USERNAME}}'
password: '${{GCR_CODEFRESH_INC_PASSWORD}}'
scale:
dev_branches_tags:
when:
branch:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}

execute_release_pipeline:
title: "Execute release pipeline in case version was changed"
fail_fast: false
image: codefresh/cli
commands:
- 'apk update && apk add jq'
- 'export PACKAGE_VERSION=$(jq -r ".version" package.json)'
- "echo Current version: $PACKAGE_VERSION"
- "git tag $PACKAGE_VERSION && echo Running release pipeline && codefresh run 5a4c94d282ed4d00012b54e8 -b=master --detach"
type: codefresh-run
arguments:
PIPELINE_ID: 'codefresh-io/cli/release'
DETACH: true
BRANCH: master
VARIABLE:
- PACKAGE_VERSION=${{PACKAGE_VERSION}}
when:
branch:
only: [ master ]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.73.30",
"version": "0.73.31",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 89b33ae

Please sign in to comment.