-
Notifications
You must be signed in to change notification settings - Fork 6
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
Image for cartesi machine download #47
Open
tuler
wants to merge
2
commits into
main
Choose a base branch
from
feature/machine-download
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: machine-download | ||
on: | ||
workflow_call: | ||
pull_request: | ||
paths: | ||
- .github/workflows/machine-download.yaml | ||
- packages/machine-download/** | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
actions: write | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get package tag/version | ||
id: package-version | ||
if: ${{ github.event_name == 'push' }} | ||
run: | | ||
jq -r '"PACKAGE_VERSION=\(.version)"' packages/machine-download/package.json >> "$GITHUB_OUTPUT" | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
docker.io/cartesi/machine-download,enable=${{ github.event_name != 'pull_request' }} | ||
ghcr.io/cartesi/machine-download | ||
tags: | | ||
type=raw,value=${{ steps.package-version.outputs.PACKAGE_VERSION }},enable=${{ github.event_name == 'push' }} | ||
type=ref,event=pr | ||
labels: | | ||
org.opencontainers.image.title=Cartesi Machine Download | ||
org.opencontainers.image.description=Cartesi Machine Download from IPFS | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- uses: depot/setup-action@v1 | ||
- name: Build and push | ||
uses: depot/bake-action@v1 | ||
with: | ||
project: ${{ vars.DEPOT_PROJECT }} | ||
workdir: packages/machine-download | ||
files: | | ||
./docker-bake.hcl | ||
./docker-bake.platforms.hcl | ||
${{ steps.meta.outputs.bake-file }} | ||
push: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v2 | ||
name: cartesi-applications-crd | ||
description: A Helm chart for Cartesi Application Custom Resource Definitions (CRDs) | ||
maintainers: | ||
- name: endersonmaia | ||
email: [email protected] | ||
url: https://github.com/endersonmaia | ||
type: application | ||
version: 0.1.0 | ||
sources: | ||
- https://github.com/cartesi/helm-charts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{- /* empty file */}} |
90 changes: 90 additions & 0 deletions
90
charts/applications-crd/templates/rollups.cartesi.io_applications.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: applications.rollups.cartesi.io | ||
spec: | ||
group: rollups.cartesi.io | ||
names: | ||
kind: Application | ||
listKind: ApplicationList | ||
plural: applications | ||
singular: application | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: Application is the Schema for the applications API | ||
properties: | ||
apiVersion: | ||
description: | ||
"APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" | ||
type: string | ||
kind: | ||
description: | ||
"Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" | ||
type: string | ||
status: | ||
description: Status defines the observed state of Application | ||
type: object | ||
metadata: | ||
type: object | ||
spec: | ||
description: Spec defines the desired state of Application | ||
type: object | ||
properties: | ||
address: | ||
description: Address of the application | ||
type: string | ||
pattern: '^0x([a-zA-Z0-9]){40}$' | ||
x-kubernetes-validations: | ||
- rule: "self != oldSelf" | ||
message: "cannot change address" | ||
blockHash: | ||
description: Block hash of the block which deployed the application | ||
type: string | ||
pattern: '^0x([a-zA-Z0-9]){64}$' | ||
x-kubernetes-validations: | ||
- rule: "self != oldSelf" | ||
message: "cannot change blockHash" | ||
blockNumber: | ||
description: Block number of the block which deployed the application | ||
type: string | ||
x-kubernetes-validations: | ||
- rule: "self != oldSelf" | ||
message: "cannot change blockNumber" | ||
transactionHash: | ||
description: Transaction hash of the transaction which deployed the application | ||
type: string | ||
pattern: '^0x([a-zA-Z0-9]){64}$' | ||
x-kubernetes-validations: | ||
- rule: "self != oldSelf" | ||
message: "cannot change transactionHash" | ||
location: | ||
description: Location of the cartesi machine snapshot | ||
type: string | ||
x-kubernetes-validations: | ||
- rule: "self != oldSelf" | ||
message: "cannot change location" | ||
type: object | ||
additionalPrinterColumns: | ||
- name: Application | ||
type: string | ||
description: Address of the application | ||
jsonPath: .spec.address | ||
- name: Location | ||
type: string | ||
description: Location of the cartesi machine snapshot | ||
jsonPath: .spec.location | ||
- name: Age | ||
type: date | ||
jsonPath: .metadata.creationTimestamp | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# empty file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,5 @@ | ||||||||||||||||||
FROM golang:1.20-bookworm as builder | ||||||||||||||||||
RUN go install github.com/ipfs/ipget@latest | ||||||||||||||||||
|
||||||||||||||||||
FROM debian:bookworm-20230725 | ||||||||||||||||||
COPY --from=builder /go/bin/ipget /usr/local/bin/ | ||||||||||||||||||
Comment on lines
+4
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Cartesi Machine Download | ||
|
||
This Docker image provides an utility to download Cartesi Machines stored in IFPS using the [CAR](https://ipld.io/specs/transport/car/carv1/) format, and extracting to a local folder. | ||
|
||
## Usage | ||
|
||
The following command will download the Cartesi Machine with the given hash and extract it to the given folder: | ||
|
||
```shell | ||
docker run -t cartesi/machine-download:devel bafybeibdpcfqtcqhgjzmo5wzi3kraxdu6f4wm2hzna4tj2enkepzvldjtq /tmp | ||
endersonmaia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
Obviously, the output directory can be in a volume mapped to outside the docker container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
target "docker-metadata-action" {} | ||
target "docker-platforms" {} | ||
|
||
target "default" { | ||
inherits = ["docker-metadata-action", "docker-platforms"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target "default" { | ||
tags = ["cartesi/machine-download:devel"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
target "docker-platforms" { | ||
platforms = [ | ||
"linux/amd64", | ||
"linux/arm64" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "@cartesi/machine-download", | ||
"private": true, | ||
"version": "0.1.0", | ||
"scripts": { | ||
"build": "docker buildx bake" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretend to use this as a workflow? if not, remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to use changesets here?
This was this way because of changesets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure.
It won't hurt keeping it that, anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case what is missing here is a release strategy, either manual tagging or changesets.
What is the strategy of helm? Manual or automated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the charts/, it's automated.
Tha tags are made by the CI after the charts hits the
main
branch, we have a release via GH Pages, to host the helm legacy way, and also use ghcr.io for the OCI Reistry way of releasing helm charts.I think we should deprecate the old way, and keep only the OCI Registry option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does it make sense to let changesets take control of the “landing on main”, and delegate the release to a workflow call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have to test.
The
ct
tool used to release already tags, won't it conflict with the changests tagging process?