Skip to content

Conversation

@potiuk
Copy link
Member

@potiuk potiuk commented Jan 8, 2021

Based on #13556

The prod images require CI images to build provider packages.

The optmisation implemented makes the CI images built only once
and the prod images will just pull the images rather than build
them again.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@potiuk
Copy link
Member Author

potiuk commented Jan 8, 2021

This PR should optimese a bit prod image preparation - instead of building CI images twice (we need them for prod images) we just wait with the PROD images until CI images are built and we pull them. This should have no impact on the elapsed time of the build because the PROD images are used for much faster K8S builds, so this is not problem if they are prepared a little later.

Tested : https://github.com/potiuk/airflow/actions/runs/470430011 (build) and https://github.com/potiuk/airflow/actions/runs/470429997 (CI) (needs to be built in the main branch).

@potiuk potiuk added this to the Airflow 2.0.1 milestone Jan 8, 2021
@potiuk potiuk force-pushed the optimise-prod-image-prepartion branch from 0e9b7af to 965902c Compare January 8, 2021 01:53
@potiuk potiuk requested a review from turbaszek January 8, 2021 01:54
@github-actions
Copy link

github-actions bot commented Jan 8, 2021

The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason.

potiuk added 2 commits January 8, 2021 03:19
The request to get manifest of the image in GitHub Packages
might randomly return either schma 1 response:

{
     "schemaVersion": 1,
     "name": "apache/airflow/master-python3.6-ci",
     "tag": "470317521",
     "architecture": "amd64",
     "fsLayers": [
        {

Or schema 2 response:

{
     "schemaVersion": 2,
     "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
     "config": {
        "mediaType": "application/vnd.docker.container.image.v1+json",
        "size": 56952,
        "digest": "sha256:5c80e2ab289647802affafc5c1efc879fe4f5b559cb7a2a1215868e84b1d6424"
     },

In order to check image more reliably we check the status code
of the curl response instead.
The prod images require CI images to build provider packages.

The optmisation implemented makes the CI images built only once
and the prod images will just pull the images rather than build
them again.
@potiuk potiuk force-pushed the optimise-prod-image-prepartion branch from 965902c to 34b00f4 Compare January 8, 2021 02:22
@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Jan 8, 2021
@github-actions
Copy link

github-actions bot commented Jan 8, 2021

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@potiuk potiuk merged commit 6570df8 into apache:master Jan 8, 2021
@potiuk potiuk deleted the optimise-prod-image-prepartion branch January 8, 2021 07:22
potiuk added a commit to PolideaInternal/airflow that referenced this pull request Jan 8, 2021
This change slightly optimizes waiting for prod images. Waiting
for images necessarily takes one slot from jobs queue, even if
those jobs do nothing at all. This is unfortunate, but seems
there is no easy way to do it differently because GitHub
Actions does not support yet cross-workflow dependencies.

This PR optimizes waiting for images in the way that PROD images
and CI images waiting happen sequentially rather than in parallell.

PROD images are, as of apache#13557 prepared sequentially which
means that there is no point to wait for PROD images in parallel
to CI images.
potiuk added a commit that referenced this pull request Jan 8, 2021
This change slightly optimizes waiting for prod images. Waiting
for images necessarily takes one slot from jobs queue, even if
those jobs do nothing at all. This is unfortunate, but seems
there is no easy way to do it differently because GitHub
Actions does not support yet cross-workflow dependencies.

This PR optimizes waiting for images in the way that PROD images
and CI images waiting happen sequentially rather than in parallell.

PROD images are, as of #13557 prepared sequentially which
means that there is no point to wait for PROD images in parallel
to CI images.
kaxil pushed a commit that referenced this pull request Jan 21, 2021
The prod images require CI images to build provider packages.

The optmisation implemented makes the CI images built only once
and the prod images will just pull the images rather than build
them again.

(cherry picked from commit 6570df8)
kaxil pushed a commit that referenced this pull request Jan 21, 2021
This change slightly optimizes waiting for prod images. Waiting
for images necessarily takes one slot from jobs queue, even if
those jobs do nothing at all. This is unfortunate, but seems
there is no easy way to do it differently because GitHub
Actions does not support yet cross-workflow dependencies.

This PR optimizes waiting for images in the way that PROD images
and CI images waiting happen sequentially rather than in parallell.

PROD images are, as of #13557 prepared sequentially which
means that there is no point to wait for PROD images in parallel
to CI images.

(cherry picked from commit 0d8536c)
kaxil pushed a commit to astronomer/airflow that referenced this pull request Apr 23, 2021
The prod images require CI images to build provider packages.

The optmisation implemented makes the CI images built only once
and the prod images will just pull the images rather than build
them again.

(cherry picked from commit 6570df8)
(cherry picked from commit 9b978c6)
kaxil pushed a commit to astronomer/airflow that referenced this pull request Apr 23, 2021
This change slightly optimizes waiting for prod images. Waiting
for images necessarily takes one slot from jobs queue, even if
those jobs do nothing at all. This is unfortunate, but seems
there is no easy way to do it differently because GitHub
Actions does not support yet cross-workflow dependencies.

This PR optimizes waiting for images in the way that PROD images
and CI images waiting happen sequentially rather than in parallell.

PROD images are, as of apache#13557 prepared sequentially which
means that there is no point to wait for PROD images in parallel
to CI images.

(cherry picked from commit 0d8536c)
(cherry picked from commit 8872e7f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools full tests needed We need to run full set of tests for this PR to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants