Skip to content

Commit

Permalink
feat(ci): improve environment variable management
Browse files Browse the repository at this point in the history
  • Loading branch information
christolis committed Sep 14, 2023
1 parent f601b94 commit c34f423
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/google.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,11 @@ jobs:
# Build the Docker image
- name: Build
run: |-
echo "$REPO_SECRETS" > secrets.json
echo "$REPO_VARS" > vars.json
jq -s '.[0] * .[1]' secrets.json vars.json > config.json
docker build \
--tag "$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/core:$PROJECT_ENV" \
--build-arg GITHUB_SHA="$GITHUB_SHA" \
--build-arg GITHUB_REF="$GITHUB_REF" \
.
env:
REPO_SECRETS: ${{ toJSON(secrets) }}
REPO_VARS: ${{ toJSON(vars) }}
# Push the Docker image to Google Artifact Registry
- name: Publish
Expand Down
7 changes: 7 additions & 0 deletions deploy/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
namespace: {{ .Release.Namespace }}
data:
{{- toYaml .Values.configMap | nindent 2 }}
5 changes: 5 additions & 0 deletions deploy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ spec:
containers:
- name: {{ .Values.container.name }}
image: {{ .Values.container.image }}
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
- secretRef:
name: {{ .Release.Name }}-secret
8 changes: 8 additions & 0 deletions deploy/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-secret
namespace: {{ .Release.Namespace }}
type: Opaque
data:
{{- toYaml .Values.secrets | nindent 2 }}

0 comments on commit c34f423

Please sign in to comment.