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

stagex refactor #433

Merged
merged 57 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9fef8d3
house cleaning
lrvick Feb 13, 2024
bf7484d
feat: qos_enclave builds with stagex
lrvick Feb 13, 2024
9d234a0
remove eif_build from tree
lrvick Feb 15, 2024
d22e1c5
working stagex qos_enclave+eif building
lrvick Feb 15, 2024
368c830
remove unused sample app
lrvick Feb 15, 2024
1a8f7d9
working stagex builds
lrvick Feb 16, 2024
139ea33
deterministic build
lrvick Feb 17, 2024
247daee
init action skeleton
emostov Feb 20, 2024
bd2f517
wip
emostov Feb 20, 2024
91d2b12
Get here doc to work
emostov Feb 21, 2024
b6a7d1a
don't make dist
emostov Feb 21, 2024
7c80aa0
get docker version
emostov Feb 21, 2024
271f03d
make it a matrix
emostov Feb 21, 2024
2df2cbf
move back docker setup to job
emostov Feb 21, 2024
c647453
Add upload to GHCR step
emostov Feb 21, 2024
92082c1
use different oci archive image names
emostov Feb 21, 2024
f031a4d
Add github registry mirror
emostov Feb 22, 2024
0e53406
update script
emostov Feb 22, 2024
e32ac66
Update skopeo copy line
emostov Feb 22, 2024
53f6e7b
remove unused CI files
lrvick Feb 28, 2024
14f1d01
github actions cleanup
lrvick Feb 28, 2024
be4bbf2
actions: fix checkout order
lrvick Feb 28, 2024
ab65e8f
fix docker setup action
lrvick Feb 28, 2024
2a5f0e1
more actions refactoring
lrvick Feb 28, 2024
a504ae5
actions: run docker setup as root
lrvick Feb 28, 2024
25a8193
actions: fix artifact name
lrvick Feb 28, 2024
bfaa78f
ci: fix qos_enclave name
lrvick Feb 28, 2024
be5dc0a
remove toolchain
lrvick Feb 29, 2024
8281c21
first pass cleaning up doc/lint/formatting in local/ci
lrvick Feb 29, 2024
72f3862
fix: make deps
lrvick Feb 29, 2024
963e339
refactor docker setup into action
lrvick Feb 29, 2024
328f53b
fix make deps for build-base
lrvick Feb 29, 2024
e8d07c1
fix: integration mocks
lrvick Mar 5, 2024
0d75430
bump to latest stagex
lrvick Mar 5, 2024
b4dd8e4
disable currently broken CI linting
lrvick Mar 5, 2024
97de073
whitespace
lrvick Mar 6, 2024
b605297
use cd because macs can't use env -C
lrvick Mar 6, 2024
286c10a
pcrs output and fixed platform lock
lrvick Mar 6, 2024
7e44a98
add out/nitro.pcrs target
lrvick Mar 7, 2024
2836f35
Deprecate reliance on release.env
emostov Mar 19, 2024
fbf02d6
Merge remote-tracking branch 'origin/zeke-remove-release-env' into la…
lrvick Mar 19, 2024
e14983a
add ecr upload
emostov Mar 28, 2024
f152f3f
fix source image name
emostov Mar 28, 2024
3c8a160
update changelog for 0.4.0
emostov Apr 9, 2024
8db8102
use bigger runner
emostov Apr 9, 2024
e7e960b
remove .gitattributes
emostov Apr 9, 2024
480607b
ignore dist
emostov Apr 12, 2024
9f248ee
remove dead aws-nsm-api deps in qos_aws
lrvick Apr 16, 2024
9381a69
fix qos_enclave paths
lrvick Apr 16, 2024
52093d7
remove dead copy in qos_enclave
lrvick Apr 16, 2024
b4665fd
refactor to OCI directories to allow for multi-level package inheritance
lrvick Apr 18, 2024
228c2cc
fix non-build targets
lrvick Apr 18, 2024
a139791
fix registry in macros
lrvick Apr 18, 2024
67c1676
fix build-context names
lrvick Apr 18, 2024
ac26b03
re-enable common/base pre-loading
lrvick Apr 18, 2024
9f94a88
more preload fixes
lrvick Apr 18, 2024
0ebb025
build only without upload
lrvick Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions .dockerignore

This file was deleted.

33 changes: 33 additions & 0 deletions .github/actions/docker-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Set up Docker"
description: "Ensure Docker is installed and configured correctly"
runs:
using: "composite"
steps:
- name: Setup and configure docker
shell: 'script -q -e -c "bash {0}"'
run: |
[[ $EUID -ne 0 ]] && exec sudo /bin/sh "$0" "$@"
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; \
do apt-get remove $pkg; \
done
apt-get update
apt-get install ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
cat << EOF >/etc/docker/daemon.json
{
"features": {
"containerd-snapshotter": true
},
"registry-mirrors": ["https://ghcr.io/tkhq"]
}
EOF
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl restart docker
docker buildx create --driver docker-container --bootstrap --name build --use
62 changes: 0 additions & 62 deletions .github/actions/lfs-setup/action.yml

This file was deleted.

139 changes: 12 additions & 127 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,147 +10,30 @@ on:
workflow_dispatch: # Allows manual invocation

jobs:
lfs-to-github-cache:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::799078726966:role/github-qos
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
submodules: true

- name: Setup LFS
uses: ./.github/actions/lfs-setup
with:
monoSshKey: ${{ secrets.MONO_SSH_KEY }}
pullLFSObjects: true

- name: Download submodules
run: GIT_LFS_SKIP_SMUDGE=1 git submodule update --init --recursive
shell: bash

- name: Generate Cache Key
id: cache-key
run: |
cache_filenames=$(make cache-filenames)
openssl sha256 $cache_filenames | openssl sha256 | awk '{ print "key="$2 }' >> $GITHUB_OUTPUT
printf "filenames<<EOF\n%s\nEOF\n" "$(printf "%s" "$cache_filenames" | tr ' ' '\n')" >> $GITHUB_OUTPUT

- name: Cache
id: cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
lookup-only: true
key: lfs-${{steps.cache-key.outputs.key}}
path: ${{steps.cache-key.outputs.filenames}}

- name: Setup Checkout
if: steps.cache.outputs.cache-hit != 'true'
run: |
make cache

build:
name: Build Toolchain Artifacts
name: build artifacts
runs-on: ubuntu-latest
needs:
- lfs-to-github-cache
strategy:
matrix:
include:
- target: qos_host.oci.x86_64.tar
- target: qos_enclave.oci.x86_64.tar
- target: qos_client.oci.x86_64.tar
timeout-minutes: 50
- target: qos_client.tar
- target: qos_host.tar
- target: qos_enclave.tar
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
submodules: true

- name: Generate Cache Key
id: cache-key
run: |
cache_filenames=$(make cache-filenames)
openssl sha256 $cache_filenames | openssl sha256 | awk '{ print "key="$2 }' >> $GITHUB_OUTPUT
printf "filenames<<EOF\n%s\nEOF\n" "$(printf "%s" "$cache_filenames" | tr ' ' '\n')" >> $GITHUB_OUTPUT

- name: Cache
id: cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
fail-on-cache-miss: true
key: lfs-${{steps.cache-key.outputs.key}}
path: ${{steps.cache-key.outputs.filenames}}

- name: Run `make out/${{ matrix.target }}`
- name: Setup Docker
uses: ./.github/actions/docker-setup
- name: Run `make`
shell: 'script -q -e -c "bash {0}"'
run: |
touch cache/toolchain.tgz
make -d toolchain-restore-mtime toolchain out/${{ matrix.target }}

make out/${{ matrix.target }}
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: ${{ matrix.target }}
path: out/${{ matrix.target }}
retention-days: 1

upload_to_ecr:
emostov marked this conversation as resolved.
Show resolved Hide resolved
name: Upload toolchain artifacts to ECR
runs-on: ubuntu-latest
needs:
- build
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::799078726966:role/github-qos

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1

- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2

- name: Upload images to ECR
env:
images: >-
qos_client
qos_enclave
qos_host
tags: >-
${{ github.ref == format('refs/heads/{0}', 'main') && 'latest' || '' }}
${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }}
${{ github.event_name == 'push' && github.ref_name || '' }}
run: |
skopeo login \
--username "${{ steps.login-ecr.outputs.docker_username_799078726966_dkr_ecr_us_east_1_amazonaws_com }}" \
--password "${{ steps.login-ecr.outputs.docker_password_799078726966_dkr_ecr_us_east_1_amazonaws_com }}" \
${{ steps.login-ecr.outputs.registry }}
for image in ${images}; do
skopeo copy --all \
"oci-archive:./${image}.oci.x86_64.tar/${image}.oci.x86_64.tar" \
"docker://${{ steps.login-ecr.outputs.registry }}/tkhq/${image}:sha-${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
for tag in ${tags}; do
skopeo copy --all \
"docker://${{ steps.login-ecr.outputs.registry }}/tkhq/${image}:sha-${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" \
"docker://${{ steps.login-ecr.outputs.registry }}/tkhq/${image}:${tag}"
done
done

upload_to_ghcr:
name: Upload toolchain artifacts to GHCR
runs-on: ubuntu-latest
Expand All @@ -162,6 +45,8 @@ jobs:
steps:
- name: Download Artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: Display structure of downloaded files
run: ls -R /home/runner/work/qos/qos
- name: Upload images to GHCR
env:
images: >-
Expand All @@ -178,8 +63,8 @@ jobs:
--password "${{ secrets.GITHUB_TOKEN }}" \
ghcr.io
for image in ${images}; do
skopeo copy --all \
"oci-archive:./${image}.oci.x86_64.tar/${image}.oci.x86_64.tar" \
skopeo copy --all --dest-decompress \
"oci-archive:/home/runner/work/qos/qos/${image}.tar/${image}.tar" \
lrvick marked this conversation as resolved.
Show resolved Hide resolved
"docker://ghcr.io/tkhq/${image}:sha-${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
for tag in ${tags}; do
skopeo copy --all \
Expand Down
Loading
Loading