Skip to content

Commit eae9e43

Browse files
github workflow added
1 parent 1db3915 commit eae9e43

File tree

2 files changed

+281
-0
lines changed

2 files changed

+281
-0
lines changed
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
---
2+
version: "v1"
3+
appName: "mqttwrk"
4+
image: "asia-south1-docker.pkg.dev/rumqtt/argonaut-gar-6af138f9/mqttwrk-rumqtt"
5+
imageTag: "latest"
6+
7+
8+
argonaut:
9+
env: rumqtt
10+
region: asia-south1
11+
cluster: rumqtt
12+
imageRegistry: argonaut-gar-6af138f9 # corresponding to the image that is to be deployed
13+
serviceType: "stateless" # One of {stateful, stateless, managed}
14+
repoName: mqttwrk
15+
git-provider: github
16+
persistentStorage:
17+
[]
18+
resources:
19+
requests:
20+
cpu: "1000m"
21+
memory: "1024M"
22+
limits:
23+
cpu: "1400m"
24+
memory: "6000M"
25+
#########################################################################################
26+
# Everything below this is optional and advanced configuration #
27+
# and irrelevant in most scenarios. #
28+
#########################################################################################
29+
30+
# Keda configuration
31+
externalServices: []
32+
podAnnotations:
33+
{}
34+
# iam.amazonaws.com/role: myapp-cluster
35+
# additionals labels
36+
labels: {
37+
argonaut.dev/git-provider: github
38+
}
39+
40+
# Allows you to load environment variables from kubernetes secret or config map
41+
envFrom: []
42+
# - secretRef:
43+
# name: env-secret
44+
# - configMapRef:
45+
# name: config-map
46+
# A list of secrets and their paths to mount inside the pod
47+
# This is useful for mounting certificates for security
48+
secretMounts:
49+
[]
50+
# - name: beamd-cert
51+
# secretName: beamd-cert
52+
# path: /usr/share/myapp/config/certs
53+
sidecarResources:
54+
{}
55+
# limits:
56+
# cpu: "25m"
57+
# # memory: "128Mi"
58+
# requests:
59+
# cpu: "25m"
60+
# memory: "128Mi"
61+
# networkHost: "0.0.0.0"
62+
# The default value of 1 will make sure that kubernetes won't allow more than 1
63+
# of your pods to be unavailable during maintenance
64+
# maxUnavailable: 25%
65+
updateStrategy: RollingUpdate
66+
# How long to wait for myapp to stop gracefully
67+
terminationGracePeriod: 30
68+
lifecycle:
69+
{}
70+
# preStop:
71+
# exec:
72+
# command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
73+
# postStart:
74+
# exec:
75+
# command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
76+
rbac:
77+
create: false
78+
serviceAccountAnnotations: {}
79+
serviceAccountName: ""
80+
# This is the PriorityClass settings as defined in
81+
# https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
82+
priorityClassName: ""
83+
# By default this will make sure two pods don't end up on the same node
84+
# Changing this to a region would allow you to spread pods across regions
85+
# This doesn't apply if antiAffinity is not set
86+
antiAffinityTopologyKey: "kubernetes.io/hostname"
87+
# "hard" means that by default pods will only be scheduled if there are enough nodes for them
88+
# and that they will never end up on the same node. Setting this to "soft" will do this best effort
89+
antiAffinity: ""
90+
# This is the node affinity settings as defined in
91+
# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#node-affinity-beta-feature
92+
nodeAffinity: {}
93+
# The default is to deploy all pods serially. By setting this to parallel all pods are started at
94+
# the same time when bootstrapping the cluster
95+
podManagementPolicy: "Parallel"
96+
podSecurityContext:
97+
{}
98+
# fsGroup: 1000
99+
# runAsUser: 1000
100+
securityContext:
101+
{}
102+
# capabilities:
103+
# drop:
104+
# - ALL
105+
# # readOnlyRootFilesystem: true
106+
# runAsNonRoot: true
107+
# runAsUser: 1000
108+
## Use an alternate scheduler.
109+
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
110+
##
111+
schedulerName: ""
112+
nodeSelector: {}
113+
tolerations: []
114+
initContainer:
115+
enabled: false
116+
# command: ["echo", "I am an initContainer"]
117+
# image: nginx
118+
initResources:
119+
{}
120+
# limits:
121+
# cpu: "25m"
122+
# # memory: "128Mi"
123+
# requests:
124+
# cpu: "25m"
125+
# memory: "128Mi"
126+
extraInitContainers:
127+
[]
128+
# - name: do-something
129+
# image: busybox
130+
# command: ['do', 'something']
131+
extraVolumes:
132+
[]
133+
# - name: extras
134+
# emptyDir: {}
135+
extraVolumeMounts:
136+
[]
137+
# - name: extras
138+
# mountPath: /usr/share/extras
139+
# readOnly: true
140+
extraContainers:
141+
[]
142+
# - name: do-something
143+
# image: busybox
144+
# command: ['do', 'something']
145+
# Allows you to add any config files in /usr/share/myapp/config/
146+
# as a ConfigMap
147+
extraConfig:
148+
[]
149+
# - name: configName
150+
# path: "/path/to/config/folder/"
151+
# readOnly: true
152+
# data:
153+
# pokedex.yaml: |
154+
# pokemonName: Pikachu
155+
# pokemonType: Lightning
156+
# battle.yaml: |
157+
# pokemon1: Pikachu
158+
# pokemon2: MewTwo
159+
# - name: configName2
160+
# path: "/path/to/config/anotherfolder/"
161+
# readOnly: true
162+
# data:
163+
# pokedex.yaml: |
164+
# pokemonName: Pikachu
165+
# pokemonType: Lightning
166+
# battle.yaml: |
167+
# pokemon1: Pikachu
168+
# pokemon2: MewTwo
169+
# Extra environment variables to append to this nodeGroup
170+
# This will be appended to the current 'env:' key. You can use any of the kubernetes env
171+
# syntax here
172+
extraEnvs: []
173+
# - name: MY_ENVIRONMENT_VAR
174+
# value: the_value_goes_here
175+
176+
# Generated at 2023-03-25 00:03:54.519944026 +0000 UTC
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "Deploy mqttwrk - rumqtt"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "**"
9+
- .github/workflows/argonaut-gcp-rumqtt-mqttwrk.yaml
10+
- Dockerfile
11+
- .art/argonaut-gcp-rumqtt-mqttwrk.yaml
12+
tags:
13+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
14+
workflow_dispatch:
15+
16+
env:
17+
18+
ART_REGISTRY_URL: asia-south1-docker.pkg.dev/rumqtt/argonaut-gar-6af138f9/mqttwrk-rumqtt
19+
20+
jobs:
21+
build:
22+
23+
environment:
24+
name: rumqtt
25+
26+
runs-on: ubuntu-latest
27+
name: Build and Push Img
28+
steps:
29+
- name: Get the version
30+
id: get_version
31+
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
32+
- name: Fetch repo
33+
uses: actions/checkout@v2
34+
with:
35+
submodules: 'recursive'
36+
- name: Get Short SHA
37+
id: get_sha
38+
run: echo ::set-output name=SHA_SHORT::$(git rev-parse --short HEAD)
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v1
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v1
43+
- name: Download art
44+
run: |
45+
curl --silent https://github.com/argonautdev/public/releases/latest/download/art-linux -L -o art
46+
chmod +x ./art
47+
mv ./art /usr/local/bin/art
48+
- name: Fetch BuildTime Secrets
49+
run: |
50+
art configure --key ${{ secrets.a27dgr3fyi4etqlo_ART_KEY }} --secret ${{ secrets.a27dgr3fyi4etqlo_ART_SECRET }}
51+
art app envvars get -f .art/argonaut-gcp-rumqtt-mqttwrk.yaml \
52+
--type buildtime \
53+
--format dotenv > art-build-secrets.env
54+
echo 'ART_BUILD_SECRETS_FILE<<EOF' >> $GITHUB_ENV
55+
cat art-build-secrets.env >> $GITHUB_ENV
56+
echo 'EOF' >> $GITHUB_ENV
57+
58+
- name: Set GCP Credentials via art
59+
run: |
60+
art configure generate-gcp-credentials --project rumqtt >> credentials.json
61+
echo "CLOUDSDK_AUTH_ACCESS_TOKEN=$(cat credentials.json | jq --raw-output '.access_token')" >> $GITHUB_ENV
62+
echo "CLOUDSDK_CORE_PROJECT=rumqtt" >> $GITHUB_ENV
63+
64+
- name: Login to GAR
65+
run: echo $CLOUDSDK_AUTH_ACCESS_TOKEN | docker login -u oauth2accesstoken --password-stdin ${{ env.ART_REGISTRY_URL }}
66+
67+
- name: Build Image
68+
uses: docker/build-push-action@v2
69+
id: build
70+
with:
71+
context: .
72+
file: ./Dockerfile
73+
push: true
74+
tags: ${{ env.ART_REGISTRY_URL }}:${{ steps.get_sha.outputs.SHA_SHORT }}
75+
build-args: |
76+
${{ env.ART_BUILD_SECRETS_FILE }}
77+
outputs: type=registry
78+
79+
deploy:
80+
81+
environment:
82+
name: rumqtt
83+
84+
runs-on: ubuntu-latest
85+
name: Deploy to Argonaut
86+
needs: build
87+
steps:
88+
- name: Fetch repo
89+
uses: actions/checkout@v2
90+
- name: Fetch branch name
91+
shell: bash
92+
run: echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/heads/}
93+
id: get_branch_name
94+
- name: Get Short SHA
95+
id: get_sha
96+
run: echo ::set-output name=SHA_SHORT::$(git rev-parse --short HEAD)
97+
- name: Download art
98+
run: curl --silent https://github.com/argonautdev/public/releases/latest/download/art-linux -L -o art
99+
- name: Configure art
100+
run: |
101+
chmod +x ./art
102+
sudo mv ./art /usr/local/bin/art
103+
art configure --key ${{ secrets.a27dgr3fyi4etqlo_ART_KEY }} --secret ${{ secrets.a27dgr3fyi4etqlo_ART_SECRET }}
104+
art app deploy -f .art/argonaut-gcp-rumqtt-mqttwrk.yaml \
105+
--set imageTag="${{ steps.get_sha.outputs.SHA_SHORT }}"

0 commit comments

Comments
 (0)