Commit Graph

31 Commits

Author SHA1 Message Date
Lester Amoin Espiritu
b9cfac3b27 Update file Containerfile 2024-12-31 20:46:38 +00:00
Gabriel Nützi
dc5da18118 fix: add missing build type behavior
- Add argument to container file.

Signed-off-by: Gabriel Nützi <gnuetzi@gmail.com>
2024-07-22 09:16:13 +02:00
Ryan Egesdahl
89457026c7 Add FIPS download for gitlab-runner
When FIPS is available on the host system, we should download the FIPS
binary for `gitlab-runner` by default. Users who do not want the FIPS
binary for some reason can use the non-FIPS binary by setting the
`ENABLE_FIPS` build-arg to `false`.
2024-04-08 00:06:30 -07:00
Gabriel Nützi
6a0ff34c9c bugfix: Correct some typos 2024-04-01 20:16:38 +00:00
Chris Evich
ded61bee62 Remove deprecated registration CLI option
Ref:
https://docs.gitlab.com/ee/update/deprecations.html#registration-tokens-and-server-side-runner-arguments-in-gitlab-runner-register-command

Thanks to @maxsatula for pointing this out.

Fixes #12

Signed-off-by: Chris Evich <cevich@redhat.com>
2024-01-08 12:57:37 -05:00
Andrey Radchishin
70b5176a33 Remove extra } 2023-12-21 09:09:45 -05:00
Andrey Radchishin
6c752ebebf Allow overriding Gitlab URL 2023-12-18 12:28:30 -05:00
Andreas Hartmann
d9f2e08b51 chore: Reorganize files into folders
to make it plain where each file belongs in the containers file system
and to simplify the `ADD` directives in the Containerfile.

Signed-off-by: Andreas Hartmann <hartan@7x.de>
2023-10-31 16:46:08 +01:00
Chris Evich
3222a2a4d1 Adopt LGPLv3 as project license
Signed-off-by: Chris Evich <cevich@redhat.com>
2023-10-17 12:09:38 -04:00
Chris Evich
d66c563c31 Fix registration permission denied
For normal operations, the `runner` user's `.gitlab-runner` directory
has a symlink for (read-only) `config.toml` ->
`/var/run/secrets/config.toml`.  However, for during registration
attempts to write to this volume-mounted file result in a
`PANIC: write: permission denied` error.  Fix this by running the
registration as (namespaced) `root` user, and using the default config.
file location of `/etc/gitlab-runner`.

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-02-03 11:23:51 -05:00
Chris Evich
9d8c463a7f Emphacise need to pre-create config.toml
The README did not make it clear enough that a blank `config.toml` file
needs to be pre-created before runner registration.  Otherwise the
`register` *runlabel* will silently fail to bind-mount the file into the
proper location inside the container.

While we're at it, also add a small example of why it may be a good idea
to edit the `config.toml` file before commiting it as a secret.

Signed-off-by: Chris Evich <cevich@redhat.com>
2023-01-31 13:43:32 -05:00
Chris Evich
6cb20272e4 Fix podman leaking conmon processes
When running in the background without a full-blown init system,
`podman system service` will leak `conmon` processes for every
gitlab-runner job that executes via the docker socket API.  These
`conmon` processes almost immediately becomes zombies, and are never
cleaned up.  Eventually the zombies will consume all available PIDs.

Many attempts to fix this in various ways have all failed.  In all cases
the GitLab Runner process will start behaving strangely (or fail
completely) after an amount of time dependent on its usage executing
jobs.

Fix this by entirely reimplementing *pipglr* to utilize systemd and a
pair of lingering user-slices.  One for podman, another for the gitlab
runner.  Include a systemd timer service to affect runner cleanup,
periodically. Also update documentation and examples accordingly.

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2023-01-28 09:59:59 -05:00
Chris Evich
bf242e8a52 Fix newuidmap...`: newuidmap: open of uid_map failed: Permission denied
Within a container, caps need to be set on /usr/bin/new{uid,gid}map
which reflect the (inner) podman user's root namespaced ID of 10000.

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-12-08 06:59:02 -05:00
Chris Evich
db6f2bceb9 Attempt fix v2.0.0 newuidmap permission denied
Recently, I believe an update or packaging problem has been causing
podman to throw errors like:

```
level=error msg="running `/usr/bin/newuidmap ...`: newuidmap: open of
uid_map failed: Permission denied\n"
```

This seems to have something to do with the shadow-utils package, which
owns this binary.  I've examined the file attribuites and permissions
along with /etc/sub{uid,gid} contents.  The only thing that seems to
resolve the issue is reinstalling shadow-utils.  Attempt that fix here
and hope it clears up the problem (present in v2.0.0)

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-12-07 06:14:45 -05:00
Chris Evich
f88c1a43bd Fix volume mounts
* Add note about volume-mounts being cumulative with base-image
* Fix register & run labels to use (correct) base image's
  `/home/podman/.local/share/containers/` instead of defining
  a new (wrong/useless) `storage` volume.
* Fix register & run labels to mask over `/var/lib/containers`
  with a read-only tmpfs to block any nested rootful use of
  podman as a security precaution.

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-12-06 03:07:40 -05:00
Chris Evich
51ce5e4e0a Use single uid/gid map
The podman base-image is intended to support running nested-podman both
root and rootless.  Since pipglr only ever runs rootless, eliminate the
nested usernamespace mapping needed to support nested-root usage.

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-12-06 02:18:55 -05:00
Chris Evich
29a806305e Include docs inside image
Signed-off-by: Chris Evich <cevich@redhat.com>
2022-11-30 09:47:18 -05:00
Chris Evich
af84720d71 Simplify image metadata
Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-23 21:38:06 -05:00
Chris Evich
5164551f98 Add metadata to image
Also, pin base image to a specific version instead of `latest`.

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-23 18:54:24 -05:00
Chris Evich
2bda4c3be6 Fix maintenance task
The function was defined but never called, resulting in immediate exit
of the maintenance script.  Fix this, also add a configuration build-arg and
ENV to control the cleaning interval.

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-23 12:10:07 -05:00
Chris Evich
a1931efcc1 Add missing cache volume
Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-22 11:35:36 -05:00
Chris Evich
df8f46eb2d Update docs and Containerfile to match
Fully tested README.md instructions end-to-end on F36.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-11-22 14:53:41 -05:00
Chris Evich
3d6603945d Bugfix
Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-19 07:42:23 -05:00
Chris Evich
ae40196724 Pre-create podman storage root
Suspected cause of ownership problems when mounting a volume at this
location.

Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-19 07:33:57 -05:00
Chris Evich
cbddc54007 Resolve TODO, update volume names, update docs.
Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-18 21:56:24 -05:00
Chris Evich
0e51bfdf8e Support externally maintained DNF cache
Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-18 21:50:34 -05:00
Chris Evich
5daaa407c8 Tweak some tag defaults
Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-16 09:23:17 -05:00
Chris Evich
9c95cf5074 Add runner-name build-arg
Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
2022-11-16 08:53:48 -05:00
Chris Evich
8066716b67 Add background cleanup process
When given the "run" argument, in addition to launching `podman system
service` in the background, also start a small periodic maintenance
script.  It's only job is to clean up stale images, containers, and
volumes from old jobs.  Currently hard-coded to trigger every 2 days,
this could be tweaked via build-args or env. var.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-11-10 14:19:09 -05:00
Chris Evich
ba2dc82ac8 Fix disused session-port var in run label
Signed-off-by: Chris Evich <cevich@redhat.com>
2022-11-10 12:07:06 -05:00
Chris Evich
9f16ea6bec initial commit
Signed-off-by: Chris Evich <cevich@redhat.com>
2022-11-10 10:36:16 -05:00