Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs on building and hosting Docker images #640

Merged
merged 51 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2e81536
Update docusaurus to current latest version.
VJalili Feb 8, 2024
de95ff2
Simplify docker documentation.
VJalili Feb 8, 2024
073e523
Rewrite the manual section to include explicit steps to take.
VJalili Feb 20, 2024
cc9b483
Remove docker from getting started as it could be a bit too technical…
VJalili Feb 20, 2024
a4d710c
Fix broken links.
VJalili Feb 20, 2024
d09bd64
Add more languages for code blocks.
VJalili Feb 20, 2024
c2b03ec
Remove unused config.
VJalili Feb 21, 2024
a9d0947
Add a link to jump to next section.
VJalili Feb 21, 2024
78fe36e
Create VM with additional disk size, & more docker login steps added.
VJalili Feb 21, 2024
95392fe
Merge remote-tracking branch 'upstream2/main' into docker_docs_docusa…
VJalili Jun 11, 2024
f69f685
pin mermaid version.
VJalili Jun 11, 2024
9c7c254
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
d99ef7e
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
b9336d2
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
065f89b
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
a151e21
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
fe91513
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
7363563
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
05b6b8d
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
532a1bf
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
c0eae33
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
17be1bd
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
a3bc9c2
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
b356aa2
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
fd6a700
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
8a81083
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
2ccc802
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
4e4842a
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
072f2f8
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
e5a3a0e
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
19034a8
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
0ae7841
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
ff2e9ad
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
e8f054b
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
a1a188d
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
74c531d
Update website/docs/advanced/docker/automated.md
VJalili Jun 12, 2024
183af24
Update website/docs/advanced/docker/images.md
VJalili Jun 12, 2024
6787076
Update website/docs/advanced/docker/images.md
VJalili Jun 12, 2024
2c66ef0
Update website/docs/advanced/docker/images.md
VJalili Jun 12, 2024
8a829dd
Update website/docs/advanced/docker/index.md
VJalili Jun 12, 2024
34eea1a
Update website/docs/advanced/docker/index.md
VJalili Jun 12, 2024
728c12a
Update website/docs/advanced/docker/index.md
VJalili Jun 12, 2024
1b4df6e
Update website/docs/advanced/docker/index.md
VJalili Jun 12, 2024
0eda328
Update website/docs/advanced/docker/index.md
VJalili Jun 12, 2024
d15bf75
Update website/docs/advanced/docker/index.md
VJalili Jun 12, 2024
7171179
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
838f550
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
738c69f
Update website/docs/advanced/docker/manual.md
VJalili Jun 12, 2024
beae959
Expand the list to better enumerate the features.
VJalili Jun 12, 2024
d767bd0
Add a tip.
VJalili Jun 12, 2024
2168d99
increase disk size.
VJalili Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions website/docs/advanced/docker/automated.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
---
title: Automated Deployment
description: Build and Publish Images
sidebar_position: 2
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';


GATK-SV Docker images are automatically built, tested, and pushed to
container registries. An automated continuous
integration and continuous delivery (CI/CD) ensures the
images are built and tested consistently and reproducibly in standardized Linux virtual machines.


The automation pipeline runs on GitHub Actions and performs a regression
test as part of every pull request. When a pull request is merged, the automation
pipeline publishes images on the Google Container Registry (GCR)
and Azure Container Registry (ACR), and updates their references.


The latest Docker images are listed in the files below.
Detailed automated deployment is described in the following sections.

<Tabs
groupId="cr"
defaultValue="gcr"
values={[
{ label: 'ACR', value: 'acr', },
{ label: 'GCR', value: 'gcr', }
]
}>
<TabItem value="acr">


[gatk-sv/inputs/values/dockers_azure.json](https://github.com/broadinstitute/gatk-sv/blob/main/inputs/values/dockers_azure.json)


</TabItem>
<TabItem value="gcr">

[gatk-sv/inputs/values/dockers.json](https://github.com/broadinstitute/gatk-sv/blob/main/inputs/values/dockers.json)


</TabItem>
</Tabs>


:::info
The detailed explanation of the automation workflow provided on this page
is intended for users who need to configure the CI/CD workflow on
their own fork of GATK-SV's GitHub repository to host Docker images on
their own container registries.


If you only need the list of latest Docker images, you may refer to the above-listed files.
:::


## Workflow Layout

The automation workflow is defined in
[`sv_pipeline.yml`](https://github.com/broadinstitute/gatk-sv/blob/main/.github/workflows/sv_pipeline_docker.yml)
and utilizes the
[`build_docker.py`](https://github.com/broadinstitute/gatk-sv/blob/main/scripts/docker/build_docker.py)
script for building and publishing Docker images.
The workflow consists of three
[_jobs_](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobs)
discussed in the following sections:

1. [Determine build arguments](#args)
2. [Regression testing](#build) (pull request and merge)
3. [Publishing Docker images](#publish) (merge only)

### Determine Build Args {#args}
This job is responsible for determining the arguments to be used by the
`build_docker.py` script, specifically:

- **Determining commit SHAs**:
Considering the large number of GATK-SV Docker images,
the workflow builds and publishes only the
Docker images affected by the changes introduced
in a pull request.
You may refer to [this page](/docs/advanced/docker/images#incremental)
on details regarding the incremental build strategy.
This job determines the commit SHAs of `HEAD` and `BASE`
commits.

- **Compose image tag**:
The images are tagged with a consistent template as the following:

```
[DATE]-[RELEASE_TAG]-[HEAD_SHA_8]
```

- `[DATE]` is in `YYYY-MM-DD`, and is extracted
from the timestamp of the last commit on the branch associated
with the pull request.
- `RELEASE_TAG` is extracted from the
latest [pre-]release on GitHub.
- `HEAD_SHA_8` denotes the first eight characters
of the `HEAD` commit SHA.

The following is an example of a tag generated
in this step:

```
2023-05-24-v0.27.3-beta-1796b665
```


### Testing Docker Image Build {#build}

This job is triggered when **a commit is pushed to the pull request branch.**
It serves the purpose of regression testing of the Docker images.
It builds Docker images according to the arguments determined in [`Determine Build Args`](#args).
If the Docker images are not successfully built, then the
job fails and all images are discarded.


### Publishing Docker Images {#publish}

This job is triggered when **a pull request is merged or a commit is pushed to the `main` branch.**
Similar to the [`Test Images Build`](#build) job,
it builds Docker images. In addition,
this job also pushes the built images to the GCR and ACR
and updates their list.
The job fails if it cannot successfully run all the steps.
The publishing process is summarized below.


- **Login**
to container registries in order to push the built images.
The job obtains authorization to push to Google and Azure container registries
by assuming a Google service account and an Azure service principal, respectively.
The credentials required to assume these identities are defined as
[encrypted environment secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets).


- **Build and publish to ACR and GCR**:
Similar to the [build job](#build), this job builds Docker images
based on the list of changed files specified using the
`HEAD` and `BASE` commit SHA. It's important to note
that the images pushed to GCR and ACR are identical and only differ in their tags.

- **Update the list of published images**:
Once the newly built images are successfully pushed,
this job updates the JSON files containing the list of images (i.e., `dockers*.json`),
and commits and pushes the changes to the `main` branch.
To achieve this, we use a _bot_ account that performs the following actions:

a. Login to git using the bot's Personal Access Token (PAT)
in order to authorize it to push to the `main` branch.

b. Configure the Git installation in the GitHub Actions VMs using the _bot_'s credentials.

c. Commit the changed files. The commit message references the
Git commit that triggered the [publish](#publish) job.

d. Push the commit to the main branch.

It is worth noting that GitHub recognizes that this push to the `main` branch is made from a GitHub
Actions environment, hence it does not trigger another [Publish](#publish) job,
avoiding infinite triggers of this job.
28 changes: 28 additions & 0 deletions website/docs/advanced/docker/dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Image Dependencies
description: Docker images code and image dependencies
sidebar_position: 4
---

## Docker Images List {#list}

The table below lists the GATK-SV Docker images and their dependencies.

| Image | Code Dependencies | Docker Dependencies |
|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| `manta` | <ul><li>`dockerfiles/manta/*`</li></ul> | |
| `melt` | <ul><li>`dockerfiles/melt/*`</li></ul> | <ul><li>`sv-base`</li></ul> |
| `scramble` | <ul><li>`dockerfiles/scramble/*`</li></ul> | |
| `wham` | <ul><li>`dockerfiles/wham/*`</li></ul> | <ul><li>`samtools-cloud`</li></ul> |
| `str` | <ul><li>`dockerfiles/str/*`</li></ul> | |
| `sv-base-mini` | <ul><li>`dockerfiles/sv-base-mini/*`</li></ul> | |
| `samtools-cloud-virtual-env` | <ul><li>`dockerfiles/samtools-cloud-virtual-env/*`</li></ul> | |
| `samtools-cloud` | <ul><li>`dockerfiles/samtools-cloud/*`</li></ul> | <ul><li>`sv-base-mini`</li><li>`samtools-cloud-virtual-env`</li></ul> |
| `sv-base-virtual-env` | <ul><li>`dockerfiles/sv-base-virtual-env/*`</li></ul> | |
| `sv-base` | <ul><li>`dockerfiles/sv-base/*`</li></ul> | <ul><li>`samtools-cloud`</li><li>`sv-base-virtual-env`</li></ul> |
| `cnmops-virtual-env` | <ul><li>`dockerfiles/cnmops-virtual-env/*`</li></ul> | <ul><li>`sv-base-virtual-env`</li></ul> |
| `cnmops` | <ul><li>`dockerfiles/cnmops/*`</li></ul> | <ul><li>`sv-base`</li><li>`cnmops-virtual-env`</li></ul> |
| `sv-pipeline-virtual-env` | <ul><li>`dockerfiles/sv-pipeline-virtual-env/*`</li></ul> | <ul><li>`sv-base-mini`</li><li>`sv-base-virtual-env`</li><li>`samtools-cloud-virtual-env`</li></ul> |
| `sv-pipeline` | <ul><li>`dockerfiles/sv-pipeline/*`</li><li> `src/RdTest/*`</li><li>`src/sv-pipeline/*`</li><li>`src/svqc/*`</li><li>`src/svtest/*`</li><li> `src/svtk/*`</li><li>`src/WGD/*`</li></ul> | <ul><li>`sv-base`</li><li>`sv-pipeline-virtual-env`</li></ul> |
| `sv-utils-env` | <ul><li>`dockerfiles/sv-utils-env/*`</li></ul> | <ul><li>`samtools-cloud-virtual-env`</li></ul> |
| `sv-utils` | <ul><li>`dockerfiles/sv-utils/*`</li><li>`src/sv_utils/src/*`</li><li> `src/sv_utils/setup.py`</li></ul> | <ul><li>`samtools-cloud`</li><li>`sv-utils-env`</li></ul> |
204 changes: 0 additions & 204 deletions website/docs/advanced/docker/deploy/automated.md

This file was deleted.

Loading
Loading