Build only option with Fig up - fig

IU have the following fig.yml:
doc1:
build: Dockerfile1
doc2:
build: Dockerfile2
Dockerfile2 is build FROM Dockerfile1.
So when I fig up I want to
Build Dockerfile1 only (not run it)
Build and Run Dockerfile2
Is this possible?

fig build doc1 doc2
fig run doc2
But build should be a path to a directory, not a path to the Dockerfile

Related

mkdir /.gitlab-runner: permission denied running GitLab Runner in Kubernetes deployed via Helm

I'm trying to deploy the GitLab Runner (15.7.1) onto an on-premise Kubernetes cluster and getting the following error:
PANIC: loading system ID file: saving system ID state file: creating directory: mkdir /.gitlab-runner: permission denied
This is occurring with both the 15.7.1 image (Ubuntu?) and the alpine3.13-v15.7.1 image. Looking at the deployment, it looks likes it should be trying to use /home/gitlab-runner, but for some reason it is trying to use root (/), which is a protected directory.
Anyone else experience this issue or have a suggestion as to what to look at?
I am using the Helm chart (0.48.0) using a copy of the images from dockerhub (simply moved into a local repository as internet access is not available from the cluster). Connectivity to GitLab appears to be working, but the error causes the overall startup to fail. Full logs are:
Registration attempt 4 of 30
Runtime platform arch=amd64 os=linux pid=33 revision=6d480948 version=15.7.1
WARNING: Running in user-mode.
WARNING: The user-mode requires you to manually start builds processing:
WARNING: $ gitlab-runner run
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner...
Created missing unique system ID system_id=r_Of5q3G0yFEVe
PANIC: loading system ID file: saving system ID state file: creating directory: mkdir /.gitlab-runner: permission denied
I have tried the 15.7.1 image, the alpine3.13-v15.7.1 image, and the gitlab-runner-ocp:amd64-v15.7.1 image and searched the values.yaml for anything relevant to the path. Looking at the deployment template, it appears that it ought to be using /home/gitlab-runner as the directory (instead of /) [though the docs suggested it was /home].
As for "what was I expecting", of course I was expecting that it would "just work" :)
So, resolved this (and other) issues with:
Updated helm deployment template to mount an empty volume at /.gitlab-runner
[separate issue] explicitly added builds_dir and environment [per gitlab-org/gitlab-runner#3511 (comment 114281106)].
These two steps appeared to be sufficient to get the Helm chart deployment working.
You can easily create and mount the emptyDir (in case you are creating gitlab-runner with kubernetes manifest *.yml file):
volumes:
- emptyDir: {}
name: gitlab-runner
volumeMounts:
- name: gitlab-runner
mountPath: /.gitlab-runner
-------------------- OR --------------------
volumeMounts:
- name: root-gitlab-runner
mountPath: /.gitlab-runner
volumes:
- name: root-gitlab-runner
emptyDir:
medium: "Memory"

Cloud function deployment issue

When I deploy cloud function I get the following error.
I am using go mod and I am able to build and run all the integration test from my sandbox,
One of the cloud function dependency uses private github repo,
When I deploy cloud function
go: github.com/myrepo/ptrie#v0.1.: git fetch -f origin refs/heads/:refs/heads/ refs/tags/:refs/tags/ in /builder/pkg/mod/cache/vcs/41e03711c0ecff6d0de8588fa6de21a2c351c59fd4b0a1b685eaaa5868c5892e: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
You might want to create a personal access token within Github and then configure git to use that token.
That command would look like this:
git config --global url."https://{YOUR TOKEN}:x-oauth-basic#github.com/".insteadOf "https://github.com/"
After that, git should be able to read from your private repo
How about using endly to automate your cloud function build, in this case you would
use go mod with vendor, where you private repo would be added to vendor folder,
Make sure that you add .gcloudignore to not incliude go.mod, go.sum
#.gcloudignore
go.mod
go.sum
The automation workflow with endly that uses private repo with credentials may look like the following
#deploy.yaml
init:
appPath: $WorkingDirectory(.)
target:
URL: ssh://127.0.0.1/
credentials: localhost
myGitSecret: ${secrets.private-git}
pipeline:
secretInfo:
action: print
comments: print git credentials (debuging only_
message: $AsJSON($myGitSecret)
package:
action: exec:run
comments: vendor build for deployment speedup
target: $target
checkError: true
terminators:
- Password
- Username
secrets:
#secret var alias: secret file i.e ~/.secret/private-git.json
gitSecrets: private-git
commands:
- export GIT_TERMINAL_PROMPT=1
- export GO111MODULE=on
- unset GOPATH
- cd ${appPath}/
- go mod vendor
- '${cmd[3].stdout}:/Username/? $gitSecrets.Username'
- '${output}:/Password/? $gitSecrets.Password'
deploy:
action: gcp/cloudfunctions:deploy
'#name': MyFn
timeout: 540s
availableMemoryMb: 2048
entryPoint: MyFn
runtime: go111
eventTrigger:
eventType: google.storage.object.finalize
resource: projects/_/buckets/${matcherConfig.Bucket}
source:
URL: ${appPath}/
Finally check out cloud function e2e testing and deployment automation

copy mutiple directories using oc new-build with source-image-path flag

when writing a build config in openshift, i can copy multiple directories from one container to another like this
source:
images:
- from:
kind: ImageStreamTag
name: 'builder:latest'
paths:
- destinationDir: .
sourcePath: /opt/app-root/src/dist/.
- destinationDir: .
sourcePath: /opt/app-root/src/openshift/conf/.
how can i do the same thing using oc new-build ?
I tried
oc new-build --source-image=builder --source-image-path=/opt/app-root/src/dist/.:. --source-image-path=/opt/app-root/src/openshift/conf/.:. --image-stream=openshift/nginx
oc new-build --source-image=builder --source-image-path /opt/app-root/src/dist/.:. /opt/app-root/src/openshift/conf/.:. --image-stream=openshift/nginx
oc new-build --source-image=builder --source-image-path=[/opt/app-root/src/dist/.:.,/opt/app-root/src/openshift/conf/.:.] --image-stream=openshift/nginx
with the fist one only one directory is being copied! and the rest are throwing an error.

Creating Openshift build from Dockerfile

I'd need to create an openshift build from a Docker image (tomcat9) which is extended through a Dockerfile. The Dockerfile adds an applications in the webapps folder.
Here's my attempt:
oc new-build --name=runtime --docker-image="docker.io/tomcat:9.0-jre8" \
--source-image=tomcat:9.0-jre8 \
--source-image-path=/home/carla/build/example.war:. \
--dockerfile=$'FROM tomcat:9.0-jre8\nCOPY example.war /usr/local/tomcat/webapps/example.war'
I have placed the webapplication (example.war) in the path /home/carla/build and I need to copy in in the /usr/local/tomcat/webapps folder of the Docker image.
The error I get is:
error: BuildConfig "runtime" is invalid: spec.triggers: Invalid value:
. . .
multiple ImageChange triggers refer to the same image stream tag
--> Failed
I think the problem is related to the -source-image parameter, however I cannot omit it as I have specified the --source-image-path.
Any idea how to fix it ?
Thanks

Creating kbskit with multiple files (in addition to main.tcl) included

I am trying to build a kbskit which includes iwidgets and img package using the following command :
./kbs.tcl -builddir=85 -r -mk-bi -bi="itcl3.4 itk3.4 iwidgets4.0.2 img1.4.1" install kbskit8.5
cp 85/bin/kbsmk8.5-bi kbsmk8.5-bi-run
ls sim.vfs
main.tcl img1.jpg
./kbsmk8.5-bi sdx.kit wrap sim -runtime kbsmk8.5-bi-run
ls
kbsmk8.5-bi kbsmk8.5-bi-run sdx.kit sim.vfs sim
./sim
couldnt open "img1.jpg": no such file or directory
while executing
"image create photo sim_img -file "img1.jpg""
(file "/home/user1/sim/main.tcl" line 10)
Why is the img1.jpg file not found here ??
I tried unwrapping to check if the file is there inside "sim" executable and it is actually present !!
cp sim /tmp
cd /tmp
./tclkit sdx.kit unwrap sim
ls sim.vfs
boot.tcl main.tcl img1.jpg boot.tcl tclkit.ico lib
ls sim.vfs/lib/
img1.4.1 itk3.4 tcl8 thread2.6.7 vfs1.4.2
itcl3.4 iwidgets4.0.2 tcl8.5 tk8.5
1) Could anyone please help me out on understanding the above behaviour ?
2) I'm building kbskit on suse 32bit. If i need to use the executable on ubuntu 32/64 bit, do i need to build another executable on ubuntu ??
You are trying to load the file img1.jpg from the current directory, which is ususally the directory from where you start the script/kit (e.g. If you start /use/bin/yourkit from /home/user, the current directory will be /home/user).
The solution is to use a relative path to your script:
image create photo sim_img -file [file join [file dirname [info script]] img1.jpg]
This only works while you source a file. You can either save the result from info script in a variable, or use the ::starkit::topdir variable, which points to the topdir of the kit, so
image create photo sim_img -file [file join $::starkit::topdir img1.jpg]
Should work as expected.