Skip to content

Commit

Permalink
Merge pull request #115 from lsst-dm/tickets/DM-40418
Browse files Browse the repository at this point in the history
DM-40418: Release Management GitHub Action
  • Loading branch information
dspeck1 authored Feb 13, 2024
2 parents 6ba045c + 8a68c17 commit c11a2e0
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 7 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
paths:
- '.github/workflows/build-base.yml'
- 'Dockerfile.main'
- 'base/Dockerfile'
branches:
- main
pull_request:
paths:
- '.github/workflows/build-base.yml'
- 'Dockerfile.main'
- 'base/Dockerfile'
workflow_dispatch:
inputs:
stackTag:
Expand Down Expand Up @@ -44,6 +44,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine base image eups tag
working-directory: base
run: |
if [[ -n "$STACK_TAG" ]]; then
if [[ "$STACK_TAG" == "*_latest" ]]; then
Expand All @@ -60,15 +61,17 @@ jobs:
echo "Eups tag = $(< eups.tag)"
- name: Build image
# Context-free build
working-directory: base
run: |
docker build - \
--build-arg "STACK_TAG=$(< lsst.docker.tag)" \
--tag $IMAGE_NAME \
--label "runnumber=${GITHUB_RUN_ID}" \
--label "stacktag=$(< stack.tag)" \
--label "eupstag=$(< eups.tag)" \
< Dockerfile.main
< Dockerfile
- name: Push image to registries
working-directory: base
run: |
MAKE_LATEST="${{ inputs.makeLatest }}"
[[ -n "$MAKE_LATEST" ]] || MAKE_LATEST="false"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:
- '.github/workflows/build-service.yml'
- 'pipelines/**'
- 'python/activator/**'
- 'Dockerfile.activator'
- 'Dockerfile'
pull_request:
paths:
- '.github/workflows/build-service.yml'
- 'pipelines/**'
- 'python/activator/**'
- 'Dockerfile.activator'
- 'Dockerfile'
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
echo "Eups tag = $(< eups.tag)"
- name: Build image
run: |
docker build . -f Dockerfile.activator \
docker build . -f Dockerfile \
--build-arg "BASE_TAG=$BASE_TAG" \
--tag $IMAGE_NAME \
--label "runnumber=${GITHUB_RUN_ID}" \
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/ci-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release CI

"on":
push:
branches-ignore:
# These should always correspond to pull requests, so ignore them for
# the push trigger and let them be triggered by the pull_request
# trigger, avoiding running the workflow twice. This is a minor
# optimization so there's no need to ensure this is comprehensive.
- "dependabot/**"
- "renovate/**"
- "tickets/**"
- "u/**"
tags:
- "*"
pull_request: {}

env:
# Base tag to run tests against.
BASE_TAG: "latest"

jobs:
build:
runs-on: ubuntu-latest

if: >
startsWith(github.ref, 'refs/tags/')
|| startsWith(github.head_ref, 'tickets/')
steps:
- uses: actions/checkout@v3

- name: Fix permissions
run: chmod -R a+rwX $GITHUB_WORKSPACE

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: |
docker run \
-v $GITHUB_WORKSPACE:/home/lsst/prompt_processing \
ghcr.io/${{ github.repository_owner }}/prompt-base:$BASE_TAG \
bash -c '
cd /home/lsst/prompt_processing
source /opt/lsst/software/stack/loadLSST.bash
setup -r .
# Fix permissions; arg must be absolute path.
git config --global --add safe.directory /home/lsst/prompt_processing
scons'
- uses: lsst-sqre/build-and-push-to-ghcr@v1
id: build
with:
image: ${{ github.repository }} # e.g. lsst-sqre/safirdemo
github_token: ${{ secrets.GITHUB_TOKEN }}

- run: echo Pushed ghcr.io/${{ github.repository }}:${{ steps.build.outputs.tag }}
1 change: 0 additions & 1 deletion Dockerfile.activator → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM ghcr.io/lsst-dm/prompt-base:${BASE_TAG}
ENV PYTHONUNBUFFERED True
ENV APP_HOME /app
ENV PROMPT_PROCESSING_DIR $APP_HOME
ARG PUBSUB_VERIFICATION_TOKEN
ARG PORT
WORKDIR $APP_HOME
COPY python/activator activator/
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions doc/playbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Table of Contents
=================

* `Containers`_
* `Release Management`_
* `Buckets`_
* `Central Repo`_
* `Development Service`_
Expand Down Expand Up @@ -65,6 +66,35 @@ Any subsequent builds of the service container will build against both bases.

This is the only situation in which a change to ``BASE_TAG_LIST`` should be committed to ``main``.

Release Management
==================

Releases are largely automated through GitHub Actions (see the `ci-release.yaml <https://github.com/lsst-dm/prompt_processing/actions/workflows/ci-release.yaml>` workflow file for details). When a semantic version tag is pushed to GitHub, Prompt Processing Docker images are published on GitHub and Docker Hub with that version.

Regular releases happen from the ``main`` branch after changes have been merged. From the ``main`` branch you can release a new major version (``X.0.0``), a new minor version of the current major version (``X.Y.0``), or a new patch of the current major-minor version (``X.Y.Z``). Release tags are semantic version identifiers following the `pep 440 <https://peps.python.org/pep-0440/>` specification. Please note that the tag does not include a ``v`` at the beginning.

1. Create a Release

On GitHub.com, navigate to the main page of the repository. To the right of the list of files, click **Releases**. At the top of the page, click **Draft a new release**. Type a tag using semantic versioning described in the previous section. The Target should be the main branch.

Select **Generate Release Notes**. This will generate a list of commit summaries and of submitters. Add text as follows.
* Any specific motivation for the release (for example, including a specific feature, preparing for a specific observing run))
* Science Pipelines version and rubin-env version
* Any changes to the APDB and Alerts schemas

Select **Publish Release**.

The `ci-release.yaml <https://github.com/lsst-dm/prompt_processing/actions/workflows/ci-release.yaml>` GitHub Actions workflow uploads the new release to GitHub packages.

2. Tag the release

At the HEAD of the ``main`` branch, create and push a tag with the semantic version:

.. code-block:: sh
git tag -s X.Y.Z -m "X.Y.Z"
git push --tags
Buckets
=======
Expand Down

0 comments on commit c11a2e0

Please sign in to comment.