Skip to content

Commit ad894c3

Browse files
authored
Merge pull request #4 from Workable/workable-sre-6908-changes-needed-for-upgrading-base-image
Changes needed for upgrading base image
2 parents bc7a32d + 4c5f685 commit ad894c3

3 files changed

Lines changed: 45 additions & 38 deletions

File tree

.github/workflows/ci.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,7 @@ jobs:
2929
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
3030
concurrent_skipping: false
3131

32-
lint:
33-
runs-on: ubuntu-latest
34-
needs: detect-noop
35-
if: needs.detect-noop.outputs.noop != 'true' && github.ref != 'refs/heads/main'
36-
steps:
37-
- name: Checkout
38-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
39-
40-
- name: Lint Dockerfile
41-
run: make lint
42-
43-
unit-tests:
44-
runs-on: ubuntu-latest
45-
needs: detect-noop
46-
if: needs.detect-noop.outputs.noop != 'true'
47-
steps:
48-
- name: Checkout
49-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50-
51-
- name: Run Unit Tests (Postgres)
52-
run: make test.unit BACKEND=postgres IMAGE_NAME=alerta-test
53-
54-
- name: Run Unit Tests (MongoDB)
55-
run: make test.unit BACKEND=mongodb IMAGE_NAME=alerta-test
56-
5732
publish-artifacts:
58-
needs: [lint, unit-tests]
5933
if: ${{ needs.detect-noop.outputs.noop != 'true' && startsWith(github.ref, 'refs/tags/workable-') }}
6034
permissions:
6135
id-token: write
@@ -66,6 +40,14 @@ jobs:
6640
- name: Checkout
6741
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6842

43+
- name: Check secrets availability
44+
id: secrets_check
45+
shell: bash
46+
run: |
47+
echo "has_sre=${{ secrets.SRE_GCR_SA != '' }}" >> $GITHUB_OUTPUT
48+
echo "has_staging=${{ secrets.STAGING_GCR_SA != '' }}" >> $GITHUB_OUTPUT
49+
echo "has_production=${{ secrets.PRODUCTION_GCR_SA != '' }}" >> $GITHUB_OUTPUT
50+
6951
- name: Get image tag
7052
id: container-info
7153
run: |
@@ -79,16 +61,27 @@ jobs:
7961
push: false
8062
tags: Workable/alerta-base:${{ steps.container-info.outputs.image-tag }}
8163
provenance: false
64+
build-args: |
65+
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
66+
RELEASE=9.0.4
67+
VERSION=${{ steps.container-info.outputs.image-tag }}
8268
8369
# DISTRIBUTION OF SRE IMAGE
70+
- name: Skip SRE registry push
71+
if: ${{ steps.secrets_check.outputs.has_sre == 'false' }}
72+
run: |
73+
echo "::warning title=SRE Registry Push Skipped::The SRE_GCR_SA secret is missing. Skipping image push to SRE registry."
74+
8475
- name: Login to sre registry
76+
if: ${{ steps.secrets_check.outputs.has_sre == 'true' }}
8577
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
8678
with:
8779
registry: us-docker.pkg.dev
8880
username: _json_key
8981
password: ${{ secrets.SRE_GCR_SA }}
9082

9183
- name: Push image to sre registry
84+
if: ${{ steps.secrets_check.outputs.has_sre == 'true' }}
9285
env:
9386
REGISTRY: us-docker.pkg.dev/sre-artifacts-20e4/gcr.io
9487
run: |
@@ -97,14 +90,21 @@ jobs:
9790
docker push ${{ env.REGISTRY }}/alerta-base:${{ steps.container-info.outputs.image-tag }}
9891
9992
# DISTRIBUTION OF STAGING IMAGE
93+
- name: Skip Staging registry push
94+
if: ${{ steps.secrets_check.outputs.has_staging == 'false' }}
95+
run: |
96+
echo "::warning title=Staging Registry Push Skipped::The STAGING_GCR_SA secret is missing. Skipping image push to Staging registry."
97+
10098
- name: Login to staging registry
99+
if: ${{ steps.secrets_check.outputs.has_staging == 'true' }}
101100
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
102101
with:
103102
registry: us-docker.pkg.dev
104103
username: _json_key
105104
password: ${{ secrets.STAGING_GCR_SA }}
106105

107106
- name: Push image to staging registry
107+
if: ${{ steps.secrets_check.outputs.has_staging == 'true' }}
108108
env:
109109
REGISTRY: us-docker.pkg.dev/staging-artifacts-786a/gcr.io
110110
run: |
@@ -113,14 +113,21 @@ jobs:
113113
docker push ${{ env.REGISTRY }}/alerta-base:${{ steps.container-info.outputs.image-tag }}
114114
115115
# DISTRIBUTION OF PRODUCTION IMAGE
116+
- name: Skip Production registry push
117+
if: ${{ steps.secrets_check.outputs.has_production == 'false' }}
118+
run: |
119+
echo "::warning title=Production Registry Push Skipped::The PRODUCTION_GCR_SA secret is missing. Skipping image push to Production registry."
120+
116121
- name: Login to production registry
122+
if: ${{ steps.secrets_check.outputs.has_production == 'true' }}
117123
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
118124
with:
119125
registry: us-docker.pkg.dev
120126
username: _json_key
121127
password: ${{ secrets.PRODUCTION_GCR_SA }}
122128

123129
- name: Push image to production registry
130+
if: ${{ steps.secrets_check.outputs.has_production == 'true' }}
124131
env:
125132
REGISTRY: us-docker.pkg.dev/production-artifacts-0b0d/gcr.io
126133
run: |

docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ echo Alerta WebUI ${WEBUI_VERSION}
8989

9090
nginx -v
9191
echo uwsgi $(uwsgi --version)
92-
mongo --version | grep MongoDB
92+
mongosh --version
9393
psql --version
9494
python3 --version
9595
/venv/bin/pip list

workable-Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM python:3.9-slim-trixie
1+
FROM python:3.9-slim-bookworm
22

3-
ENV PYTHONUNBUFFERED 1
3+
ENV PYTHONUNBUFFERED=1
44
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
55
ENV PIP_NO_CACHE_DIR=1
66

@@ -53,8 +53,8 @@ RUN apt-get update && \
5353
apt-get -y autoremove && \
5454
rm -rf /var/lib/apt/lists/*
5555

56-
RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - && \
57-
echo "deb https://nginx.org/packages/debian/ buster nginx" | tee /etc/apt/sources.list.d/nginx.list && \
56+
RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg && \
57+
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] https://nginx.org/packages/debian/ bookworm nginx" | tee /etc/apt/sources.list.d/nginx.list && \
5858
apt-get update && \
5959
apt-get install -y --no-install-recommends \
6060
nginx && \
@@ -63,11 +63,11 @@ RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - && \
6363
rm -rf /var/lib/apt/lists/*
6464

6565
# hadolint ignore=DL3008
66-
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - && \
67-
echo "deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list && \
66+
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-archive-keyring.gpg && \
67+
echo "deb [signed-by=/usr/share/keyrings/mongodb-archive-keyring.gpg] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list && \
6868
apt-get update && \
6969
apt-get install -y --no-install-recommends \
70-
mongodb-org-shell && \
70+
mongodb-mongosh && \
7171
apt-get -y clean && \
7272
apt-get -y autoremove && \
7373
rm -rf /var/lib/apt/lists/*
@@ -80,7 +80,7 @@ RUN pip install --no-cache-dir pip virtualenv jinja2 && \
8080
/venv/bin/pip install --no-cache-dir --upgrade setuptools && \
8181
/venv/bin/pip install --no-cache-dir --requirement /app/requirements.txt && \
8282
/venv/bin/pip install --no-cache-dir --requirement /app/requirements-docker.txt
83-
ENV PATH $PATH:/venv/bin
83+
ENV PATH=$PATH:/venv/bin
8484

8585
RUN /venv/bin/pip install alerta==${CLIENT_VERSION} alerta-server==${SERVER_VERSION}
8686
COPY install-plugins.sh /app/install-plugins.sh
@@ -91,9 +91,9 @@ ADD https://github.com/alerta/alerta-webui/releases/download/v${WEBUI_VERSION}/a
9191
RUN tar zxvf /tmp/webui.tar.gz -C /tmp && \
9292
mv /tmp/dist /web
9393

94-
ENV ALERTA_SVR_CONF_FILE /app/alertad.conf
95-
ENV ALERTA_CONF_FILE /app/alerta.conf
96-
ENV ALERTA_WEB_CONF_FILE /web/config.json
94+
ENV ALERTA_SVR_CONF_FILE=/app/alertad.conf
95+
ENV ALERTA_CONF_FILE=/app/alerta.conf
96+
ENV ALERTA_WEB_CONF_FILE=/web/config.json
9797

9898
COPY config/templates/app/ /app
9999
COPY config/templates/web/ /web

0 commit comments

Comments
 (0)