Skip to content

Commit 8c9ac06

Browse files
committed
trigger pipeline
1 parent 00f6856 commit 8c9ac06

File tree

4 files changed

+86
-24
lines changed

4 files changed

+86
-24
lines changed

.appcd.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
version: 0.0.1
2+
name: DogeApi
23
services:
34
dogeapi:
45
dtr: ghcr.io/appcd-dev/dogeapi/dogeapi
6+
path: ./
57
tag: latest
6-
dockerFile: Dockerfile
8+
language: Python
9+
dockerFile: ./Dockerfile

.github/workflows/appcd-iac-pr-diff.yml

+70-19
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,97 @@
11
name: APPCD Diff check
22
on:
3+
push:
4+
branches:
5+
- feature/sks-test
36
pull_request:
47
branches:
58
- main
69
jobs:
710
compare-artifacts:
11+
permissions:
12+
contents: write
13+
pull-requests: write
814
runs-on: ubuntu-latest
915
steps:
1016
- name: Checkout Main Branch
11-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1218
with:
1319
ref: main
1420
path: main_branch
15-
- name: Login to docker
16-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
17-
21+
fetch-depth: 1
1822
- name: Generate IaC from Main Branch
23+
env:
24+
APPCD_TOKEN: ${{ secrets.APPCD_TOKEN }}
25+
APPCD_URL: ${{ secrets.APPCD_URL }}
1926
run: |
20-
mkdir -p artifact/main/
27+
mkdir -p artifact/main/ ./artifact/tmp
2128
docker run --rm \
22-
--workdir=/code \
23-
-v ./main_branch:/code -v ./artifact/main:/artifact/main ghcr.io/appcd-dev/appcd-dist/appcd@sha256:a38ade31e60f3f7f76b1135a388db158eed3c90816d5b5c09e33dd806efb67d5 \
24-
generate --mode ci --output=/artifact/main/.appcd/charts
29+
--workdir=/app/scan \
30+
-e APPCD_TOKEN=$APPCD_TOKEN \
31+
-e APPCD_URL=$APPCD_URL \
32+
-v ./main_branch:/app/scan \
33+
-v ./artifact/tmp:/tmp \
34+
-v ./artifact/main:/artifact/main \
35+
--entrypoint=appcd \
36+
ghcr.io/appcd-dev/appcd-dist/appcd:cli \
37+
generate --log 2 --output=/artifact/main/.appcd/charts
38+
cd artifact/main/.appcd/charts
39+
unzip scan.zip && rm scan.zip && ls -latr && pwd
40+
- name: Upload logs
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: analyzer_logs_1
44+
path: artifact
2545
- name: Checkout PR Branch
26-
uses: actions/checkout@v2
46+
uses: actions/checkout@v4
2747
with:
2848
ref: ${{ github.head_ref }}
2949
path: pr_branch
50+
fetch-depth: 1
3051
- name: Extract branch name
3152
id: extract_branch
3253
run: echo "branch=$(basename ${{ github.head_ref}})" >> $GITHUB_OUTPUT
3354
- name: echo branch name
3455
run: echo ${{ steps.extract_branch.outputs.branch }}
3556
- name: Generate IaC from PR branch
57+
env:
58+
APPCD_TOKEN: ${{ secrets.APPCD_TOKEN }}
59+
APPCD_URL: ${{ secrets.APPCD_URL }}
3660
run: |
37-
mkdir -p artifact/${{ steps.extract_branch.outputs.branch }}/
61+
mkdir -p artifact/${{ steps.extract_branch.outputs.branch }}/ ./artifact/tmp
3862
docker run --rm \
39-
--workdir=/code \
40-
-v ./pr_branch/:/code -v ./artifact/${{ steps.extract_branch.outputs.branch }}:/artifact/${{ steps.extract_branch.outputs.branch }} ghcr.io/appcd-dev/appcd-dist/appcd@sha256:a38ade31e60f3f7f76b1135a388db158eed3c90816d5b5c09e33dd806efb67d5 \
41-
generate --mode ci --output=/artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts
63+
--workdir=/app/scan \
64+
-v ./pr_branch/:/app/scan \
65+
-v ./artifact/${{ steps.extract_branch.outputs.branch }}:/artifact/${{ steps.extract_branch.outputs.branch }} \
66+
-v ./artifact/tmp:/tmp \
67+
-e APPCD_TOKEN=$APPCD_TOKEN \
68+
-e APPCD_URL=$APPCD_URL \
69+
--entrypoint=appcd \
70+
ghcr.io/appcd-dev/appcd-dist/appcd:cli \
71+
generate --mode ci --lang Python --log 2 --iac-type Helm --output=/artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts
72+
cd artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts
73+
unzip scan.zip && rm scan.zip && ls -latr
74+
- name: Upload logs
75+
uses: actions/upload-artifact@v2
76+
with:
77+
name: analyzer_logs_2
78+
path: artifact
4279
- name: Generate diff between Main and PR branch
4380
run: |
4481
mkdir -p pr_branch/deployment_files
45-
mv ./artifact/main/.appcd pr_branch/deployment_files/
82+
mv ./artifact/main/.appcd/charts/helm/scan_*/* pr_branch/deployment_files/
4683
cd pr_branch
4784
git config --local user.email "action@github.com"
4885
git config --local user.name "GitHub Action"
4986
git add deployment_files
5087
git commit -m "staging deployment files from main to compare them"
51-
rm -rf deploment_files/*
52-
rm -rf deployment_files/.appcd
88+
rm -rf deploment_files
5389
cd ..
54-
mv artifact/${{ steps.extract_branch.outputs.branch }}/.appcd pr_branch/deployment_files/
90+
mkdir -p pr_branch/deployment_files/
91+
cp -R artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts/helm/scan_*/* pr_branch/deployment_files/
5592
cd pr_branch
56-
git diff --output=../diff.txt deployment_files/ | cat
93+
git add .
94+
git diff --staged --output=../diff.txt deployment_files/ | cat
5795
cat ../diff.txt
5896
- name: Comment PR with IaC Changes
5997
uses: actions/github-script@v6
@@ -62,7 +100,20 @@ jobs:
62100
script: |
63101
const fs = require('fs');
64102
const diff = fs.readFileSync('diff.txt', 'utf-8');
65-
const body = `### AppCD AppStack: http://demo.dev.appcd.io/appstacks/DogeAPI/\n ### IaC Diff:\n\`\`\`${diff}\`\`\``;
103+
const body = `### AppCD Diff:\n\`\`\`${diff}\`\`\``;
104+
await github.rest.issues.createComment({
105+
issue_number: context.issue.number,
106+
owner: context.repo.owner,
107+
repo: context.repo.repo,
108+
body: body
109+
})
110+
- name: Trigger atlantis plan
111+
uses: actions/github-script@v6
112+
with:
113+
github-token: ${{secrets.GITHUB_TOKEN}}
114+
script: |
115+
const fs = require('fs');
116+
const body = `atlantis plan`;
66117
await github.rest.issues.createComment({
67118
issue_number: context.issue.number,
68119
owner: context.repo.owner,

.github/workflows/docker-publish.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
runs-on: ubuntu-latest
2525

2626
steps:
27-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 1
2830

2931
- name: Run tests
3032
run: |
@@ -50,6 +52,8 @@ jobs:
5052

5153
steps:
5254
- uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 1
5357

5458
- name: Build image
5559
run: docker build . --file Dockerfile --tag $IMAGE_NAME
@@ -91,9 +95,11 @@ jobs:
9195
- name: run appCD
9296
run: |
9397
docker run --rm \
94-
--workdir=/code \
95-
-v $PWD:/code ghcr.io/appcd-dev/appcd-dist/appcd@sha256:a38ade31e60f3f7f76b1135a388db158eed3c90816d5b5c09e33dd806efb67d5 \
96-
generate --mode ci --output=/code/.appcd/charts
98+
--workdir=/code \
99+
-v $PWD:/code ghcr.io/appcd-dev/appcd-dist/appcd-cli:v0.9.0 \
100+
generate --mode ci --lang Python --iac-type Helm --output=/code/.appcd/charts
101+
cd .appcd/charts && ls
102+
unzip DogeAPI.zip && rm DogeAPI.zip
97103
98104
- name: Inflate helm chart in gitops/
99105
run: |

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,5 @@ dev.pem
174174
.appcd/charts/
175175
cpg.bin
176176
analyzer.log
177+
helm
178+
terraform

0 commit comments

Comments
 (0)