Skip to content

Commit

Permalink
Problem: testground image not pushed to registry
Browse files Browse the repository at this point in the history
Solution:
- push to github container registry
  • Loading branch information
yihuang committed Jun 20, 2024
1 parent 54ae5cf commit 176d927
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 363 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Push Testground Image

on:
push:
branches:
- main
tags:
- "v*.*.*"

env:
IMAGE_NAME: testground-testcase

jobs:

push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: cronos
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: build and push image
run: |
REPO_NAME=${{ github.event.repository.name }}
TAG=${{ github.ref_name }}
OCI_ARCHIVE=$(nix build --no-link --print-out-paths .#testground-image)
echo $REPO_NAME $TAG $OCI_ARCHIVE
skopeo --insecure-policy copy --dest-creds="${REPO_NAME}:${{ secrets.GITHUB_TOKEN }}" "docker-archive:${OCI_ARCHIVE}" "docker://${REPO_NAME}/testground-image:${TAG}"
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
let
pkgs = import nixpkgs {
inherit system;
overlays = self.overlays.default;
overlays = self.overlays.default ++ [
(import ./testground/benchmark/overlay.nix)
];
config = { };
};
in
rec {
packages = pkgs.cronos-matrix // {
inherit (pkgs) rocksdb;
inherit (pkgs) rocksdb testground-image;
};
apps = {
cronosd = mkApp packages.cronosd;
Expand Down
32 changes: 32 additions & 0 deletions nix/benchmark.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ lib, poetry2nix, python311, nix-gitignore }:
let
overrides = poetry2nix.overrides.withDefaults
(self: super:
let
buildSystems = {
pystarport = [ "poetry-core" ];
durations = [ "setuptools" ];
multitail2 = [ "setuptools" ];
docker = [ "hatchling" "hatch-vcs" ];
pyunormalize = [ "setuptools" ];
};
in
lib.mapAttrs
(attr: systems: super.${attr}.overridePythonAttrs
(old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
}))
buildSystems
);
in
poetry2nix.mkPoetryApplication {
projectDir = nix-gitignore.gitignoreSourcePure [
"/*" # ignore all, then add whitelists
"!/benchmark/"
"!poetry.lock"
"!pyproject.toml"
] ../testground/benchmark;
python = python311;
inherit overrides;
}

16 changes: 16 additions & 0 deletions nix/testground-image.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ dockerTools, cronos-matrix, test-env, testground-testcase }:
dockerTools.buildLayeredImage {
name = "cronos-testground";
contents = [
testground-testcase
test-env
cronos-matrix.cronosd
];
config = {
Expose = [ 9090 26657 26656 1317 26658 26660 26659 30000 ];
Cmd = [ "/bin/testground-testcase" ];
Env = [
"PYTHONUNBUFFERED=1"
];
};
}
Loading

0 comments on commit 176d927

Please sign in to comment.