Skip to content
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

Build aptos-node-v1.23.3 #22

Merged
merged 3 commits into from
Nov 21, 2024
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
32 changes: 21 additions & 11 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@ on:
- main

env:
APTOS_GIT_REVISION: aptos-node-v1.23.2
APTOS_GIT_REF: aptos-node-v1.23.3

concurrency: docker

jobs:
prep:
runs-on: ubuntu-latest
outputs:
aptos_git_sha: ${{ steps.checkout.outputs.commit }}
steps:

Choose a reason for hiding this comment

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

Instead of cloning/downloading the repo, would it make more sense to just use the github REST API?
https://api.github.com/repos/aptos-labs/aptos-core/git/refs/tags/aptos-node-v1.23.3 seems to return everything we need.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea, but it'll be a little trickier to be able to support other ref kinds (branches, commits).

- name: Checkout aptos-core
id: checkout
uses: actions/checkout@v4
with:
repository: aptos-labs/aptos-core
ref: ${{ env.APTOS_GIT_REF }}

build_push:
permissions:
contents: read
Expand All @@ -28,6 +40,10 @@ jobs:
- runner: ARM64
platform: linux/arm64

needs: prep
env:
APTOS_GIT_REF: ${{ needs.prep.outputs.aptos_git_sha }}
PLATFORM: ${{ matrix.platform }}
runs-on:
- self-hosted
- ${{ matrix.runner }}
Expand All @@ -50,23 +66,17 @@ jobs:
uses: docker/bake-action@v5
with:
targets: cache-builder-base,cache-runtime-base
env:
PLATFORM: ${{ matrix.platform }}

- name: Bake and populate binaries cache
uses: docker/bake-action@v5
with:
targets: cache-binaries
env:
PLATFORM: ${{ matrix.platform }}

- name: Bake images
uses: docker/bake-action@v5
with:
targets: aptos-node,aptos
push: ${{ github.event_name == 'push' }}
env:
PLATFORM: ${{ matrix.platform }}

manifest:
permissions:
Expand All @@ -77,7 +87,7 @@ jobs:
matrix:
target: [aptos-node, aptos]

needs: build_push
needs: [prep, build_push]
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
Expand All @@ -90,6 +100,6 @@ jobs:

- name: Create manifest
run: |
docker buildx imagetools create -t ghcr.io/shinamicorp/${{ matrix.target }}:${{ env.APTOS_GIT_REVISION }} \
ghcr.io/shinamicorp/${{ matrix.target }}:${{ env.APTOS_GIT_REVISION }}-linux-amd64 \
ghcr.io/shinamicorp/${{ matrix.target }}:${{ env.APTOS_GIT_REVISION }}-linux-arm64 \
docker buildx imagetools create -t ghcr.io/shinamicorp/${{ matrix.target }}:${{ env.APTOS_GIT_REF }} \
ghcr.io/shinamicorp/${{ matrix.target }}:${{ needs.prep.outputs.aptos_git_sha }}-linux-amd64 \
ghcr.io/shinamicorp/${{ matrix.target }}:${{ needs.prep.outputs.aptos_git_sha }}-linux-arm64 \
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ FROM builder-base AS builder
WORKDIR /usr/src/aptos

# Shallow clone of a specific commit
ARG APTOS_GIT_REVISION
ARG APTOS_GIT_REF
RUN git init && \
git remote add origin https://github.com/aptos-labs/aptos-core.git && \
git fetch --depth 1 origin ${APTOS_GIT_REVISION} && \
git fetch --depth 1 origin ${APTOS_GIT_REF} && \
git checkout FETCH_HEAD

RUN cargo build --locked --release --package aptos-node
Expand Down
8 changes: 4 additions & 4 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable "APTOS_GIT_REVISION" {}
variable "APTOS_GIT_REF" {}

variable "PLATFORM" {}

Expand All @@ -15,12 +15,12 @@ variable "_REMOTE_CACHE_RUNTIME_BASE" {
}

variable "_REMOTE_CACHE_BINARIES" {
default = "type=registry,ref=ghcr.io/shinamicorp/aptos:cache-binaries-${APTOS_GIT_REVISION}-${_PLATFORM_TAG}"
default = "type=registry,ref=ghcr.io/shinamicorp/aptos:cache-binaries-${APTOS_GIT_REF}-${_PLATFORM_TAG}"
}

function "tag" {
params = [target]
result = "ghcr.io/shinamicorp/${target}:${APTOS_GIT_REVISION}-${_PLATFORM_TAG}"
result = "ghcr.io/shinamicorp/${target}:${APTOS_GIT_REF}-${_PLATFORM_TAG}"
}

function "local_cache_dir" {
Expand All @@ -31,7 +31,7 @@ function "local_cache_dir" {
target "_common" {
platforms = [PLATFORM]
args = {
APTOS_GIT_REVISION = APTOS_GIT_REVISION
APTOS_GIT_REF = APTOS_GIT_REF
}
cache-from = [
"type=local,src=${local_cache_dir("builder-base")}",
Expand Down