Buildctl command to tag multiple images - docker-buildkit

I am using Buildkit to build and push the images. I would like to add multiple tags on the images in buildctl command. For eg
buildctl build --frontend=dockerfile.v0 --local context=. --local dockerfile=. --output=type=image,name=test/repo:tag1,test/repo:tag2,push=true
Above command fails. Please suggest how can i use buildctl command to tag the image with tag1 and tag2 and push it
Using exporter doesnt works it reports that exporter is deprecated

In order to tag and push multiple images (and/or tags), you have to escape the images:
buildctl build \
--frontend dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--output type=image,\"name=test/repo:tag1,test/repo:tag2\",push=true

Related

GH Actions Argo workflow, fails when setting env.var "cant unmarshal obj into Go struct fld Container.spec.templates.container.env of type []v1.EnvVar

- name: Generate argo workflow yaml file
run: |
helm template \
--set image.repository=${{ env.DOCKER_REPOSITORY }} \
--set image.tag=${TAG} \
--set env.TEST="TEST" \
-f backfill/helm/values.yaml $APP_NAME charts/job > workflow-dev.yaml
I'm deploying the argo workflow via GH actions. If I remove the env.TEST, line the workflow is deployed and works. Also, I'm able to set env.vars using the values file; but, when I try to set env.vars in the GH actions it gives this error:
msg="Failed to parse workflow: json: cannot unmarshal object into Go struct field Container.spec.templates.container.env of type []v1.EnvVar"
Any idea? I'm stuck on this for some time.

Helm: Expanding environment variables in values.yaml with helm install or upgrade

In our Jenkins pipeline, I'm using a bash script to call the helm install command. We have a values.yaml containing most of the values to be passed to helm. However, few values are based upon environment variables and have to be passed using the --set argument. Here is the snippet:
helm install $RELEASE_NAME shared/phoenixmsp-app -f value.yaml \
--set global.env.production=$production \
--set global.cluster.hosts=${CONFIG[${CLUSTER_NAME}]} \
--set nameOverride=$RELEASE_NAME \
--set fullnameOverride=$RELEASE_NAME \
--set image.repository=myhelm.hub.mycloud.io/myrepo/mainservice \
--set-string image.tag=$DOCKER_TAG \
--wait --timeout 180s --namespace $APP_NAMESPACE"
We want to move these --set parameters to values.yaml. The goal is to get rid of --set and simply pass the values.yaml.
Question: Is it possible to expand Environment Variables in values.yaml while calling with helm install or helm upgrade?
The only way I think you can do that, if you really want to use a single yaml is to have a template values.yaml and either sed the values into it or use a templating language like jinja or mustache, then feed the resulting output into helm.
--set is a good solution here, but if you really don't want that, dynamically write a second values file for the run-time values.
echo "
global:
env:
production: $production
cluster:
hosts: ${CONFIG[${CLUSTER_NAME}]}
nameOverride: $RELEASE_NAME
fullnameOverride: $RELEASE_NAME
image:
repository: myhelm.hub.mycloud.io/myrepo/mainservice
tag: $DOCKER_TAG
" > runtime.yaml
helm install $RELEASE_NAME shared/phoenixmsp-app -f value.yaml -f runtime.yaml \
--wait --timeout 180s --namespace $APP_NAMESPACE
This really does nothing but slightly reduce the precedence, though.
If all these values are known ahead of time, maybe build your runtime.yaml in advance and throw it into a git repo people can peer-review before deployment time, and just use the variables to select the right file from the repo.

AsyncAPI: Only generate payload

Is it possible to skip generation of specific files using asyncapi-generator?
I am using the Go generator but I only need the payload.go. Right now it always generates all files:
handlers.go payloads.go publishers.go router.go server.go subscribers.go
The command I am using is:
$ docker run --rm -it \
-v ${PWD}/asyncapi.yaml:/app/asyncapi.yml \
-v ${PWD}/output:/app/output \
asyncapi/generator -o /app/output /app/asyncapi.yml #asyncapi/go-watermill-template --force-write
You cannot selectively generate only selected files yet. I encourage you to join the related discussion on GitHub
From what I understand is that you are interested only in models generation. So maybe you should just use directly the Modelina tool that is used there in go-watermill-template.
Modelina is already integrated with AsyncAPI CLI and you can do asyncapi generate models golang asyncapi.yml

How to list the published container images in the Google Container Registry in a CLI in image size order

Using a CLI, I want to list the images in each repository in a Google Container Registry project but with the following conditions:
Lists the images with the latest tag only
Lists the human-readable size of the images
Lists the name of the images
The closest I've managed to get us through gsutil:
gsutil du -h gs://eu.artifacts.my-registry.appspot.com/containers/images
Resulting in:
33.77 MiB gs://eu.artifacts.my-registry.appspot.com/containers/images/sha256:03c1a2387ef6cb30a7428a46821f946d6a2c591a26cb2066891c55b2b6846ae2
1.27 MiB gs://eu.artifacts.my-registry.appspot.com/containers/images/sha256:03c1e7db6bf0140bd5fa34236a35453cb73cef01f6d89b98bc5995ae8ea07aaf
1.32 KiB gs://eu.artifacts.my-registry.appspot.com/containers/images/sha256:03c3c97495d60c68d37d04a7e6c9b3a48bb159ce5dde13d0d81b4e75e2a3f1d4
81.92 KiB gs://eu.artifacts.my-registry.appspot.com/containers/images/sha256:03c5483cb8ac9c9ae498507e15d68d909a11859a8e5238556b7188e0af4d9264
457.43 KiB gs://eu.artifacts.my-registry.appspot.com/containers/images/sha256:03c7f98faa1cfc05264e743e23ca2e118d24c57bfd67d5cb2e2c7a57e8124b6c
7.88 KiB gs://eu.artifacts.my-registry.appspot.com/containers/images/sha256:03c83b13d044844cd3f6b278382e408541f22029acaf55d9e7e5689b8d51eeea
But obviously this does not meet most of my criteria.
The information is available through the GUI like so on a per image basis:
Any ideas?
I'm open to gsutil, gcloud, docker, anything really which can be installed on a docker container.
You can use the Google Cloud UI to accomplish this. There's a column selector right next to the filter bar and it has an option for the image size.
Once the column is displayed, you'll be able to order by size.
Its seems you have only one outstanding issue with listing container images size after reading your comment at Jason's answer. So it is not possible to retrieve with gcloud command directly. Here are two work around I tested:
You can use gcloud container images describe command to see the size of the images. Make sure you use "--log-http" flag with it. Command should be like this:
$ gcloud container images describe gcr.io/myproject/myimage:tag --log-http
Another way to get the size of the image is using gsutil stat command.
So here's what I did:
a. Upon running below command, I listed all my images from the GCS bucket and saved it to a file called images.txt
$ gsutil ls "BUCKET URL" > images.txt
b. I ran gcloud stat command like below to read image names from the images.txt file and return size of the images chronologically.
$ for x in $(cat images.txt); do `gsutil stat $x | grep Content-Length | awk '{print $2}'`; done
You can customize this little script according to your need.
I understand these are not efficient workaround but thats all seems to be an option now. However, GCR just implements the docker container API, so may be you can read this document to see if you can find/do something of your own.
Hi here just to share a rudimental script which takes the first tag and get the size of the whole layers and write it on a report, it takes ages on 3TB repo but at least i know which repo is big.
echo "REPO,SIZE" > repository-size-report.csv
for REPO in $(gcloud container images list --repository eu.gcr.io/comerge-comerge01-171833 --format="table[no-heading](NAME)") ; do
for TAGS in $(gcloud container images list-tags $REPO --format="table[no-heading](TAGS)"); do
TAG=$(echo $TAGS | cut -d, -f1)
SUM=0
for SIZE in $(gcloud container images describe $REPO:$TAG --log-http 2>&1 | grep size | grep -o '[0-9][0-9]*') ; do
SUM=$((SUM + SIZE))
done
HSUM=$(echo $SUM | numfmt --to iec --format "%8f")
echo "$REPO:$TAG,$HSUM"
echo "$REPO:$TAG,$HSUM" >> repository-size-report.csv
done
done
You can use the command gcloud container images list command to accomplish this task; however, you will need to set the appropriate flags to fulfill your use case. You can read more about the command and the flag options here.

Inkscape: Unable to find verb ID 'AlignHorizontalLeft' specified on the command line

Version
inkscape --version
Inkscape 0.48.4 r9939 (Jan 22 2014)
I'm running the following inkscape command:
inkscape -f test.svg \
--select=hanzi --verb=AlignHorizontalLeft --verb=EditDeselect \
--select=pinyin --verb=AlignHorizontalRight --verb=EditDeselect \
--select=hanzi --select=pinyin \
--verb=AlignVerticalCenter --verb=SelectionUnion \
--verb=FileSave --verb=FileQuit
And get the error:
Unable to find: AlignHorizontalLeft
Unable to find verb ID 'AlignHorizontalLeft' specified on the command line.
Unable to find: AlignHorizontalRight
Unable to find verb ID 'AlignHorizontalRight' specified on the command line.
Unable to find: AlignVerticalCenter
Unable to find verb ID 'AlignVerticalCenter' specified on the command line.
I can find related verbs when reading inkscape --verbs-list output.
What is the replacement for those verbs ? I need a solution as a cli command.
From IRC channel #inkscape:
ed8 | Any help for a replacement to the following verbs:
AlignHorizontalLeft, AlignHorizontalRight, AlignVerticalCenter in 0.48
?
su_v | ed8: those verbs only exist in trunk (i.e. they will be available in the next major release)
So you need to install using the PPA Inkscape trunk.

Resources