1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00

55 Commits

Author SHA1 Message Date
Ryan Wallace
4ac6522bd5 feat: add IRSA support when creating Quay.io clients (PROJQUAY-9228) (#4312) 2025-11-19 09:51:47 -05:00
Kenny Lee Sin Cheong
5f63b3a7bb chore: drop deprecated tables and remove unused code (PROJQUAY-522) (#2089)
* chore: drop deprecated tables and remove unused code

* isort imports

* migration: check for table existence before drop
2023-08-25 12:17:24 -04:00
Oleg Bulatov
1643b40c3a fix: Pass CONTAINER_RUNTIME to quay-builder (PROJQUAY-5910) (#2096) 2023-08-07 15:50:53 -04:00
Marcus Kok
1a60cbe7fb buildman: add SLO metric that calculates build success (PROJQUAY-4486) (#1609)
Added a counter metrics to track total number of build jobs and total number of failed builds. These can be used to calculate the build success rate in grafana.
2022-11-28 13:16:45 -05:00
Marcus Kok
ea67af5a04 buildman: add SLO metric for time spent in queue for build jobs (PROJQUAY-4487) (#1575)
This adds a metric that calculates the time a build job spends in the queue.
2022-11-02 16:59:08 -04:00
Kenny Lee Sin Cheong
9a11e4760e buildman: allow fallback on non-exception build failures (PROJQUAY-4609) (#1605)
i.e Failed api calls caused by the external builder servic (expired
certificate, network issues, ...)
2022-11-02 12:36:19 -04:00
Dave O'Connor
db225c3293 Bump PyJWT (#1465) 2022-08-08 11:02:09 -04:00
Brandon Caton
b8d3e17406 builders: Add cacert's to build agent (PROJQUAY-3819) (#1398)
Allows the quay-builder to use user provided certificates.
2022-07-06 08:31:55 -04:00
Brandon Caton
d11d45f208 builders: Send notifications on build completion (PROJQUAY-3614) (#1346)
Currently builds do not send notifications on success or failure. Adding calls to send out those notifications.
2022-06-02 09:49:19 -04:00
Brandon Caton
1d2e55b63d builders: Set imagePullPolicy to always (PROJQUAY-3507) (#1330)
Currently imagePullPolicy is set to IfNotPresent. This will ignore updates to the builder image.
2022-05-17 10:05:26 -04:00
Kenny Lee Sin Cheong
e3b170ea3f buildman: fix type when getting ec2 ami (#1328) 2022-05-13 12:37:33 -04:00
Brandon Caton
3a63fd7187 builders: Add dnsPolicy option (PROJQUAY-3755) (#1305)
Some clusters use `dnsPolicy: ClusterFirst` while we have the field hardcoded to `Default`. This change allows the field to be configurable.
2022-05-09 11:15:31 -04:00
Brandon Caton
9557cb9abb builders: Set default kubernetesPodman image (PROJQUAY-3586) (#1245)
Update kubernetesPodman builders default image with the production image.
2022-05-02 10:34:46 -04:00
Brandon Caton
d8ae686f9b builders: Persist build pod when DEBUG is true (PROJQUAY-3710) (#1297)
In the previous kubernetes executor the build job was persisted in DEBUG mode due to the virtual machine in the pod never exiting. This kept the job alive for users to view the debug information. The `kubernetesPodman` executor does not run the VM so it will be cleaned up due to `ttlSecondsAfterFinished` being set on the job. This change prevents the `ttlSecondsAfterFinished` field from being set when DEBUG is true, allowing the pod to stay alive to retrieve the logs.
2022-04-29 16:24:03 -04:00
Brandon Caton
88e86eb11e builders: Set backoffLimit to 1 (PROJQUAY-3587) (#1246)
Setting the backoffLimit to 1 for kubernetes and kubernetesPodman builds. Prevents subsequent attempts from failing due to the token expiring. Having the job recreate pods is unnecessary as the build manager already has the retry logic.
2022-04-18 09:13:26 -04:00
Brandon Caton
ef91c57c23 format: Updating black to resolve click dependency issue (PROJQUAY-3487) (#1209)
Currently the CI breaks due to a dependency of black, `click`, breaking with it's latest release with `ImportError: cannot import name '_unicodefun' from 'click'`. Since black does not pin it's version of click it pulls in the latest version containing the breaking change and fails the CI check. This updates black with the patch. [See the original issue here.](https://github.com/psf/black/issues/2964) The rest of the changes are format updates introduced with the latest version of black.
2022-03-29 15:34:57 -04:00
Brandon Caton
4ecbcded06 builders: Add DEBUG and JOB_REGISTRATION_TIMEOUT options (PROJQUAY-3395) (#1177)
Adding JOB_REGISTRATION_TIMEOUT to take effect on generating the build registration token. Also adding the DEBUG option to the kubernetesPodman executor.
2022-03-10 11:40:57 -05:00
Brandon Caton
ceb9262b7e buildman: Add EXECUTOR parameter (PROJQUAY-3278) (#1134)
Changes made to allow use of a single quay-builder image for kubernetes and kubernetesPodman builds.
Implements the following changes:
- Added EXECUTOR env var to kubernetsPodman job configuration
- Updated the builder ignition config to overwrite the registry.conf file to set short name mode to permissive
- Always run the quay-builder in the VM as root
2022-03-02 14:37:21 -05:00
Kenny Lee Sin Cheong
3ca44073b1 buildman: prevent systemd oneshot service from timing (PROJQUAY-3304) (#1149)
If not set, TimeoutStartSec for the Docker service is set to
600. Since it's a service of type oneshot, this should either not be
set, or at least the length of the machine's lifetime.
2022-02-25 15:34:28 -05:00
Kenny Lee Sin Cheong
32691dd812 buildman: Set build token expiration to builder's lifetime (PROJQUAY-3281) (#1142)
Make sure the build token doesn't expire before the builder instance
does. Set the expiration to the builder instances' max expiration.
2022-02-23 18:11:19 -05:00
Kenny Lee Sin Cheong
a0443340cb buildman: fix multiple build retries phase (PROJQUAY-3281) (#1139)
Allow the build to move forward if it is already in the desired
phase/state. When a build fails, ang gets retried from the queue, its
phase doesn't get updated back to WAITING. So it is possible that it
is already in a phase such as SCHEDULED, which could prevent the
buildman from marking the new attempt as scheduled, as there would be
no aparent changes made to the build phase.
2022-02-23 13:01:39 -05:00
Kenny Lee Sin Cheong
9b89262640 buildman: configurable build job registration timeout (PROJQUAY-3280) (#1135)
With the previous 15 sec hard-coded value, some build could
sporadically expire before having the time to boot start instance and
make the registration rpc call. Change the default to 30 sec, and make
it configurable.
2022-02-22 10:11:57 -05:00
Brandon Caton
a29e64be18 buildman: Add kubernetesPodman build option (PROJQUAY-3052) (#1066)
Additional option allowing for Quay builds to leverage Podman directly in Openshift.
2022-02-11 09:01:55 -05:00
Kenny Lee Sin Cheong
eaaa3adbf0 buildman: allow use of public builder image (PROJQUAY-3179) (#1103)
These username + password are only necessary if the quay-builder image is private, and should be optional
2022-02-09 12:37:15 -05:00
Kenny Lee Sin Cheong
b07b44a7eb buildman: fix kubernetes not returning correct running count (PROJQUAY-3169) (#1099)
Filter the completed or failed jobs from the kubernetes api requests.
2022-02-09 09:51:57 -05:00
Ivan Bazulic
f5b9492ac6 buildman: Add proxy variables to builds if they exist (PROJQUAY-2120) (#834)
* buildman: Add proxy variables to builds if they exist (PROJQUAY-2120)

Adds the ability to define proxy variables for builders. The proxy variables are parsed as env. variables and defined in Quay's config.yaml file.

* buildman: Add proxy variables to builds if they exist (PROJQUAY-2120)

Adds the ability to define proxy variables for builders. The proxy variables are parsed as env. variables and defined in Quay's config.yaml file.
2021-07-13 10:53:26 -04:00
Kenny Lee Sin Cheong
b28965cdf6 Update log level when unable to write build duration metrics to a WARNING (#665)
Update the log level from EXCEPTION to WARNING when getting a KeyError
from the orchestrator. The KeyError is valid and happens when a build
has expired.
2021-01-22 14:40:37 -05:00
Kenny Lee Sin Cheong
6578618d9a Remove extra extra parameter when calling commit_sha (#660)
Remove extra extra parameter when calling commit_sha when a private key is used during a build
2021-01-20 10:58:19 -05:00
Alec Merdler
1346005404 fix default value for 'server_grpc_addr' in build manager (#657) 2021-01-14 18:33:43 -08:00
Kenny Lee Sin Cheong
cba3492970 Don't replace port by default 55443 if BUILDMAN_HOSTNAME is defined (#654) 2021-01-14 14:49:38 -05:00
Kenny Lee Sin Cheong
d4aa9d5b5c Copy the certs needed to allow the clients (docker or podman) to operate on self signed registries (#647)
See:
- https://docs.docker.com/engine/security/certificates/
- https://github.com/containers/image/pull/594/files
2021-01-11 15:18:36 -05:00
Kenny Lee Sin Cheong
6b1c1fb717 Add a DEBUG flag to the executors to prevent cleanup (#631)
When set to true, DEBUG will prevent the build nodes from shutting
down after the quay-builder service is done or fails, and will prevent the
build manager from cleaning up the instances (terminating EC2
instances or deleting k8s jobs).

This will allow debugging builder node issues, and should not be set
in a production environment.

The lifetime service will still exist. i.e The instance will still
shutdown after ~2h (EC2 instances will terminate, k8s jobs will
complete)

Setting DEBUG will also affect ALLOWED_WORKER_COUNT, as the
unterminated instances/jobs will still count towards the total number
of running workers.
2020-12-21 10:30:59 -05:00
Kenny Lee Sin Cheong
f325ba2e7a Use correct nginx port in ignition template (#628)
Generate the ignition template used by the builder using the correct
externally exposed secured GRPC port (55443).
2020-12-17 12:39:07 -05:00
Kenny Lee Sin Cheong
c9ac4aac1f PROJQUAY-1382 - Various small buildman fixes (#624)
* Fix log sequence check + CachedTag grpc message field name

* Various buildmanager fix

- Correctly overwrite the expiration on heartbeat
- Log formatting fixes
- Return True/False on successful/failed append build log
2020-12-15 09:49:58 -05:00
Kenny Lee Sin Cheong
6107bb944a Fix mis-indentation introduced in 8da8df5 (#622) 2020-12-14 09:46:12 -05:00
Kenny Lee Sin Cheong
8da8df5a71 PROJQUAY-1376 - Handle non 200 api response from executors (#619)
* Handle non 200 api response from executors

* Allows the CA cert to be specified in the config for server verification

Allow the CA cert used for server verification to be specified in the
config even if client certificate authentication is not used.
Handles non-200 responses from executors when trying to get worker count.
2020-12-10 17:17:37 -05:00
Kurtis Mullins
bd7252c536 [PROJQUAY-1021] task: Update "Black" to version 20.8b1 2020-11-30 18:48:19 -05:00
Kenny Lee Sin Cheong
89fcf7701a Json + jinja syntax fix in the ignition cloud config template (#605) 2020-11-30 11:03:40 -05:00
Kenny Lee Sin Cheong
6f441e9889 PROJQUAY-1255 grpc nginx ssl (#603)
* Use safe_load when loading the config yaml

* Setup nginx ssl termination for grpc endpoints

* Bootstrap Quay's ca cert in the build executor nodes

* Update certificate mount point in ignition config

Mount the Fedora CoreOS/RHCOS based cert directory to /certs in the
builder container, where it will be installed by the container's
entrypoint.
2020-11-25 11:46:56 -05:00
Kenny Lee Sin Cheong
6c6555774a p# This is a combination of 2 commits. (#601)
Allow specifying the container runtime to the templated ignition file

Allow specifying the container runtime in the executor's ignition
file. This allow for different runtimes, e.g Docker, Podman to run a build.
2020-11-23 15:26:16 -05:00
Kenny Lee Sin Cheong
139dba3ed4 Removes the http scheme from the server address (#597)
The http scheme should be specified as a dial option on the grpc Go client, not as part of the address.
2020-11-18 11:51:58 -05:00
Kenny Lee Sin Cheong
1fdc86976e Buildman rewrite (#591)
* Reenable builder in supervisord config

* Rewrites the buildmanager to use gRPC

Rewrite of the current buildmanager using gRPC.
This deprecates the enterprise type builder, as individual nodes will
no longer keep track of build states because of WAMP.

Also removes trollius, which was required by the WAMP servers.
Instead, gRPC uses a threaded model to serve its requests.

Deprecates etcd as state trakcing for build states in favor of Redis
only.

Defines a state interface to manage/transition build states, implemented by the
buildmanager.

* Fix incorrect reference to aws connection

* Truncate the "Token" tag in ec2 to 36 char.

Normalize the token tag to 36 char in EC2.
Add an expiration to the original redis key, in the event that the
expiry handler is not able to delete the key, the original should be
removed eventually.

* Orchestrator: add context to KeyError

* EXPOSE 50051 in Dockerfiles

* Add buildman/README
2020-11-02 10:31:48 -05:00
Kenny Lee Sin Cheong
cee2ab56d9 Implement executor methods to get the count of running builders (#582)
Used by the manager to schedule builds based on the current running
count. Uses the specific executors' api to get the count of running
builders instead of Redis/Orchestrator.

This is due to issues encountered in the past where the manager would
have problems scheduling builds, and go into a weird state when
Redis was unavailable.

Remove wamp's REALM/websocket parameters from executor

Remove asyncio from executor
2020-10-22 10:17:40 -04:00
Kenny Lee Sin Cheong
27c6e2b99b Reduce log noise from fallbacks in executor (#526) 2020-08-19 16:24:10 -04:00
Kenny Lee Sin Cheong
fce130e8ed Try to remove the redis key if when scheduling build it already exists (#490) 2020-07-21 13:45:59 -04:00
Kenny Lee Sin Cheong
08cfd7ead1 Update the executor image from Container Linux to Fedora CoreOS (#434)
* Update the executor image from Container Linux to Fedora CoreOS

* Move the container cloud config script for templating from devtable to quay's repo

* Ignition config template

* Move dockersystemd from devtable repo

* Remove pinned dependency on devtable/container-cloud-config

* Removes squashed image and logentries

* Update builder image

* Update mounted cert directory for Fedora

* Removes old clouconfig template

* Pass userdata as firmware config to qemu

* Use CentOS:8 as base image
2020-07-14 12:55:47 -04:00
Kenny Lee Sin Cheong
5ebc48d53e Migrate to boto3 in the build executor (#467)
* Migrate to boto3 in the build executor

* Add required default values to aws calls
2020-07-13 09:05:02 -04:00
Kurtis Mullins
f1237bdb29 [PROJQUAY-753] Reduce logging noise (#445) 2020-06-18 13:54:20 -04:00
Kurtis Mullins
38be6d05d0 Python 3 (#153)
* Convert all Python2 to Python3 syntax.

* Removes oauth2lib dependency

* Replace mockredis with fakeredis

* byte/str conversions

* Removes nonexisting __nonzero__ in Python3

* Python3 Dockerfile and related

* [PROJQUAY-98] Replace resumablehashlib with rehash

* PROJQUAY-123 - replace gpgme with python3-gpg

* [PROJQUAY-135] Fix unhashable class error

* Update external dependencies for Python 3

- Move github.com/app-registry/appr to github.com/quay/appr
- github.com/coderanger/supervisor-stdout
- github.com/DevTable/container-cloud-config
- Update to latest mockldap with changes applied from coreos/mockldap
- Update dependencies in requirements.txt and requirements-dev.txt

* Default FLOAT_REPR function to str in json encoder and removes keyword assignment

True, False, and str were not keywords in Python2...

* [PROJQUAY-165] Replace package `bencode` with `bencode.py`

- Bencode is not compatible with Python 3.x and is no longer
  maintained. Bencode.py appears to be a drop-in replacement/fork
  that is compatible with Python 3.

* Make sure monkey.patch is called before anything else (

* Removes anunidecode dependency and replaces it with text_unidecode

* Base64 encode/decode pickle dumps/loads when storing value in DB

Base64 encodes/decodes the serialized values when storing them in the
DB. Also make sure to return a Python3 string instead of a Bytes when
coercing for db, otherwise, Postgres' TEXT field will convert it into
a hex representation when storing the value.

* Implement __hash__ on Digest class

In Python 3, if a class defines __eq__() but not __hash__(), its
instances will not be usable as items in hashable collections (e.g sets).

* Remove basestring check

* Fix expected message in credentials tests

* Fix usage of Cryptography.Fernet for Python3 (#219)

- Specifically, this addresses the issue where Byte<->String
  conversions weren't being applied correctly.

* Fix utils

- tar+stream layer format utils
- filelike util

* Fix storage tests

* Fix endpoint tests

* Fix workers tests

* Fix docker's empty layer bytes

* Fix registry tests

* Appr

* Enable CI for Python 3.6

* Skip buildman tests

Skip buildman tests while it's being rewritten to allow ci to pass.

* Install swig for CI

* Update expected exception type in redis validation test

* Fix gpg signing calls

Fix gpg calls for updated gpg wrapper, and add signing tests.

* Convert / to // for Python3 integer division

* WIP: Update buildman to use asyncio instead of trollius.

This dependency is considered deprecated/abandoned and was only
used as an implementation/backport of asyncio on Python 2.x
This is a work in progress, and is included in the PR just to get the
rest of the tests passing. The builder is actually being rewritten.

* Target Python 3.8

* Removes unused files

- Removes unused files that were added accidentally while rebasing
- Small fixes/cleanup
- TODO tasks comments

* Add TODO to verify rehash backward compat with resumablehashlib

* Revert "[PROJQUAY-135] Fix unhashable class error" and implements __hash__ instead.

This reverts commit 735e38e3c1d072bf50ea864bc7e119a55d3a8976.
Instead, defines __hash__ for encryped fields class, using the parent
field's implementation.

* Remove some unused files ad imports

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee@redhat.com>
Co-authored-by: Tom McKay <thomasmckay@redhat.com>
2020-06-05 16:50:13 -04:00
Jimmy Zelinskie
a57f7ecc4b reverts histograms to default buckets
This is in attempts to keep the codebase as idiomatic as possible.
An addition benefit of reverting to the default histogram buckets is
that the slowest route durations more accurate.
2020-02-11 11:49:37 -05:00