Skip to content

Commit ceb7f16

Browse files
committed
OPS-3 Simulate staging
1 parent 4d068a4 commit ceb7f16

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

.github/workflows/simulate-environment-reporting-dev.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ name: Report development snapshot
33
# On a normal setup the backend and frontend built in the two build jobs would
44
# deploy the two artifacts to a server, and we would have set up reporting
55
# of the environment to kosli. In this example we do not have a server so
6-
# we just simulate that we deploy to development
6+
# we just simulate that we have deployed to development
77

88
on:
99
schedule:
1010
- cron: '*/5 * * * *' # Runs every 5 minutes (smallest possible)
11+
workflow_dispatch:
1112

1213
env:
1314
# kosli commands picks up org, env, trail and api-token from these environment variables
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Report staging snapshot
2+
3+
# On a normal setup the backend and frontend built in the two build jobs would
4+
# deploy the two artifacts to a server, and we would have set up reporting
5+
# of the environment to kosli. In this example we do not have a server so
6+
# we just simulate that we have deployed to staging
7+
8+
on:
9+
schedule:
10+
- cron: '*/5 * * * *' # Runs every 5 minutes (smallest possible)
11+
workflow_dispatch:
12+
13+
env:
14+
# kosli commands picks up org, env, trail and api-token from these environment variables
15+
KOSLI_ORG: kosli-public
16+
KOSLI_ENV: jira-integration-example-staging
17+
KOSLI_API_TOKEN: "${{ secrets.KOSLI_PUBLIC_API_TOKEN }}"
18+
KOSLI_CLI_VERSION: "2.11.8"
19+
20+
jobs:
21+
report-snapshot:
22+
name: Report staging snapshot
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
ref: staging-running
28+
29+
- name: Setup Kosli cli
30+
uses: kosli-dev/setup-cli-action@v2
31+
with:
32+
version:
33+
${{ env.KOSLI_CLI_VERSION }}
34+
35+
- name: Report snapshot
36+
run: |
37+
kosli snapshot paths ${{ env.KOSLI_ENV }} \
38+
--paths-file server-paths-file.yml

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
SHELL := bash
2+
3+
deploy_to_staging:
4+
@git remote update
5+
@git status --untracked-files=no | grep --silent "Your branch is up to date" || (echo "ERROR: your branch is NOT up to date with remote" && exit 1)
6+
git tag staging-${TIMESTAMP}
7+
git push origin staging-${TIMESTAMP} $(args)
8+
9+
# The rest is a little extra for simulating the staging environment.
10+
@if git rev-parse staging-running >/dev/null 2>&1; then \
11+
git tag -d staging-running; \
12+
git push --delete origin staging-running; \
13+
fi
14+
git tag staging-running
15+
git push origin staging-running

apps/backend/backend-content.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
This is just a file to test out that changes to back-end source code
22
can trigger a build, reporting to Kosli and Jira
33

4-
counter=2
4+
counter=3

0 commit comments

Comments
 (0)