Skip to content

Commit

Permalink
Merge branch 'main-enterprise' into dependabot/github_actions/Azure/k…
Browse files Browse the repository at this point in the history
…8s-deploy-5
  • Loading branch information
decyjphr authored Dec 19, 2024
2 parents 1387362 + 506613f commit 09dfab4
Show file tree
Hide file tree
Showing 50 changed files with 8,861 additions and 13,784 deletions.
18 changes: 13 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/javascript-node/.devcontainer/base.Dockerfile
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
ARG VARIANT=16-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
ARG VARIANT=20-bookworm
FROM mcr.microsoft.com/devcontainers/javascript-node:1-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends python pip
&& apt-get -y install --no-install-recommends python3 python3-pip

# [Optional] Uncomment if you want to install an additional version of node using nvm
# ARG EXTRA_NODE_VERSION=10
Expand All @@ -17,6 +17,14 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# Update npm
RUN npm install -g npm
# Intall aws cli
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && sudo ./aws/install
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install && \
rm -rf ./aws && \
rm awscliv2.zip
# Install sam cli
RUN pip install aws-sam-cli
RUN curl -L "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-$(dpkg --print-architecture).zip" -o "aws-sam-cli.zip" && \
unzip aws-sam-cli.zip -d sam-installation && \
sudo ./sam-installation/install && \
rm -rf ./sam-installation && \
rm aws-sam-cli.zip
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"args": { "VARIANT": "16-bullseye" }
"args": { "VARIANT": "20-bookworm" }
},

"settings": {},
Expand All @@ -34,4 +34,4 @@

"remoteUser": "node",

}
}
2 changes: 1 addition & 1 deletion .github/workflows/create-pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: 'npm'
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: "npm"
Expand Down Expand Up @@ -68,6 +68,7 @@ jobs:

helm:
runs-on: ubuntu-latest
needs: build
steps:
- name: Clone repo
uses: actions/checkout@v4
Expand All @@ -84,8 +85,8 @@ jobs:
run: |
cd helm
helm registry login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
helm package --app-version ${{ github.ref_name }} --version ${{ github.ref_name }} safe-settings
helm push safe-settings-${{ github.ref_name }}.tgz ${{ env.HELM_REPO }}
helm package --app-version ${{ needs.build.outputs.release }} --version ${{ needs.build.outputs.release }} safe-settings
helm push safe-settings-${{ needs.build.outputs.release }}.tgz ${{ env.HELM_REPO }}
#trigger-deployment:
# needs: build
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/delete-old-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Delete old releases
permissions: write-all

on:
workflow_dispatch:
inputs:
beforeDate:
type: string
required: true
description: YYYY-MM-DD - All releases before this date are deleted.
default: "2024-01-01"

jobs:
delete-releases:
runs-on: ubuntu-latest
steps:
- name: Delete releases
run: |
for i in $(gh release list --repo https://github.com/$GITHUB_REPOSITORY --json createdAt,tagName --limit 1000 | jq --arg date $BEFORE_DATE '.[] | select(.createdAt < $date ) | .tagName' | tr -d '"'); do gh release delete $i -y --cleanup-tag --repo https://github.com/$GITHUB_REPOSITORY ; done
echo Deleted releases before $BEFORE_DATE in https://github.com/$GITHUB_REPOSITORY >> $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BEFORE_DATE: ${{ inputs.beforeDate }}


8 changes: 4 additions & 4 deletions .github/workflows/deploy-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: azure/login@v1
- uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- uses: azure/aks-set-context@v3
- uses: azure/aks-set-context@v4
with:
resource-group: ${{env.AZURE_RESOURCE_GROUP}}
cluster-name: ${{env.AZURE_AKS_CLUSTER}}
id: login
- run: |
kubectl get deployment
- name: app-env
uses: azure/k8s-create-secret@v4
uses: azure/k8s-create-secret@v5
with:
namespace: 'default'
secret-type: 'generic'
arguments: --from-literal=APP_ID=${{ secrets.APP_ID }} --from-literal=PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} --from-literal=WEBHOOK_SECRET=${{ secrets.WEBHOOK_SECRET }}
secret-name: app-env
- name: Set imagePullSecret
uses: azure/k8s-create-secret@v4
uses: azure/k8s-create-secret@v5
with:
namespace: ${{env.AZURE_AKS_NAMESPACE}}
container-registry-url: ${{env.IMAGE_REGISTRY_URL}}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm install
- run: npm run test:unit:ci
strategy:
matrix:
node-version:
- 18
- 20
2 changes: 1 addition & 1 deletion .github/workflows/rc-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.x
cache: npm
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v20
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:20-alpine
WORKDIR /opt/safe-settings
ENV NODE_ENV production
## Set the Labels
Expand All @@ -8,12 +8,12 @@ LABEL version="1.0" \

## These files are copied separately to allow updates
## to the image to be as small as possible
COPY package.json /opt/safe-settings/
COPY package*.json /opt/safe-settings/
COPY index.js /opt/safe-settings/
COPY lib /opt/safe-settings/lib

## Install the app and dependencies
RUN npm install
RUN npm ci

## This app will listen on port 3000
EXPOSE 3000
Expand All @@ -22,4 +22,4 @@ USER node

## This does not start properly when using the ['npm','start'] format
## so stick with just calling it outright
CMD npm start
CMD npm start
Loading

0 comments on commit 09dfab4

Please sign in to comment.