Skip to content

Commit

Permalink
Add arm64 packaging support
Browse files Browse the repository at this point in the history
  • Loading branch information
randomanderson authored Nov 14, 2023
1 parent 8fe9497 commit 48ffd4c
Showing 1 changed file with 52 additions and 10 deletions.
62 changes: 52 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ variables:
default:
tags: [ "runner:main", "size:large" ]

build-image:
.build-image-base:
stage: manual-images
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push"
changes:
- .gitlab/Dockerfile-*
when: manual
allow_failure: true
tags: [ "runner:docker" ]
image: $DOCKER_REGISTRY/docker:20.10.13
parallel:
matrix:
Expand All @@ -41,11 +40,23 @@ build-image:
script:
- >
docker build
--tag $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:$CI_PIPELINE_ID
--tag $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION-$ARCHITECTURE:$CI_PIPELINE_ID
--file .gitlab/Dockerfile-$RUBY_VERSION
.
- docker push --all-tags $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION
- docker push --all-tags $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION-$ARCHITECTURE

build-image-amd64:
extends: .build-image-base
tags: [ "runner:docker" ]
variables:
ARCHITECTURE: amd64

build-image-arm64:
extends: .build-image-base
tags: [ "runner:docker-arm", "platform:arm64"]
variables:
ARCHITECTURE: arm64

promote-image:
stage: manual-images
when: manual
Expand All @@ -55,13 +66,14 @@ promote-image:
matrix:
# ADD NEW RUBIES HERE
- RUBY_VERSION: [ '3.2.2', '3.1.4', '3.0.6', '2.7.8' ]
ARCHITECTURE: [ 'amd64', 'arm64' ]
script:
- docker pull $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:$CI_PIPELINE_ID
- docker tag $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:$CI_PIPELINE_ID $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:current
- docker push $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:current
- docker pull $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION-$ARCHITECTURE:$CI_PIPELINE_ID
- docker tag $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION-$ARCHITECTURE:$CI_PIPELINE_ID $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION-$ARCHITECTURE:current
- docker push $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION-$ARCHITECTURE:current

install-base-ruby-gems:
image: $RUBY_CUSTOM_IMAGE_BASE/3.2.2:current
image: $RUBY_CUSTOM_IMAGE_BASE/3.2.2-$ARCHITECTURE:current
needs:
- check-gem-presence
stage: package
Expand All @@ -70,6 +82,14 @@ install-base-ruby-gems:
when: on_success
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: on_success
parallel:
matrix:
- ARCHITECTURE: amd64
TAG: "runner:main"
- ARCHITECTURE: arm64
TAG: "arch:arm64"
tags:
- $TAG
script:
# This would install all dependencies
- .gitlab/prepare_pkg_directory.sh
Expand All @@ -79,10 +99,17 @@ install-base-ruby-gems:
- pkg

install-version-dependant-gems:
image: $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION:current
image: $RUBY_CUSTOM_IMAGE_BASE/$RUBY_VERSION-$ARCHITECTURE:current
parallel:
matrix:
- RUBY_VERSION: ["2.7.8", "3.0.6", "3.1.4"]
ARCHITECTURE: amd64
TAG: "runner:main"
- RUBY_VERSION: ["2.7.8", "3.0.6", "3.1.4"]
ARCHITECTURE: arm64
TAG: "arch:arm64"
tags:
- $TAG
rules:
- if: $RUBY_PACKAGE_VERSION
when: on_success
Expand All @@ -99,7 +126,7 @@ install-version-dependant-gems:
- pkg

check-gem-presence:
image: $RUBY_CUSTOM_IMAGE_BASE/3.2.2:current
image: $RUBY_CUSTOM_IMAGE_BASE/3.2.2-amd64:current
rules:
- if: $RUBY_PACKAGE_VERSION
when: on_success
Expand All @@ -124,6 +151,21 @@ package:
- ls ../pkg
- ../.gitlab/build-deb-rpm.sh

package-arm:
extends: .package-arm
needs:
- check-gem-presence
- install-version-dependant-gems
- install-base-ruby-gems
rules:
- if: $RUBY_PACKAGE_VERSION
when: on_success
- if: '$CI_COMMIT_TAG =~ /^v.*/'
when: on_success
script:
- ls ../pkg
- ../.gitlab/build-deb-rpm.sh

.release-package:
stage: deploy
variables:
Expand Down

0 comments on commit 48ffd4c

Please sign in to comment.