Skip to content

Commit ded847b

Browse files
committed
trigger pipeline
1 parent 00f6856 commit ded847b

File tree

4 files changed

+88
-24
lines changed

4 files changed

+88
-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

+72-19
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,99 @@
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+
docker pull ghcr.io/appcd-dev/appcd-dist/appcd-cli:cli
28+
mkdir -p artifact/main/ ./artifact/tmp
2129
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
30+
--workdir=/app/scan \
31+
-e APPCD_TOKEN=$APPCD_TOKEN \
32+
-e APPCD_URL=$APPCD_URL \
33+
-v ./main_branch:/app/scan \
34+
-v ./artifact/tmp:/tmp \
35+
-v ./artifact/main:/artifact/main \
36+
--entrypoint=appcd \
37+
ghcr.io/appcd-dev/appcd-dist/appcd-cli:cli \
38+
generate --log 2 --output=/artifact/main/.appcd/charts
39+
cd artifact/main/.appcd/charts
40+
unzip scan.zip && rm scan.zip && ls -latr && pwd
41+
- name: Upload logs
42+
uses: actions/upload-artifact@v2
43+
with:
44+
name: analyzer_logs_1
45+
path: artifact
2546
- name: Checkout PR Branch
26-
uses: actions/checkout@v2
47+
uses: actions/checkout@v4
2748
with:
2849
ref: ${{ github.head_ref }}
2950
path: pr_branch
51+
fetch-depth: 1
3052
- name: Extract branch name
3153
id: extract_branch
3254
run: echo "branch=$(basename ${{ github.head_ref}})" >> $GITHUB_OUTPUT
3355
- name: echo branch name
3456
run: echo ${{ steps.extract_branch.outputs.branch }}
3557
- name: Generate IaC from PR branch
58+
env:
59+
APPCD_TOKEN: ${{ secrets.APPCD_TOKEN }}
60+
APPCD_URL: ${{ secrets.APPCD_URL }}
3661
run: |
37-
mkdir -p artifact/${{ steps.extract_branch.outputs.branch }}/
62+
docker pull ghcr.io/appcd-dev/appcd-dist/appcd-cli:cli
63+
mkdir -p artifact/${{ steps.extract_branch.outputs.branch }}/ ./artifact/tmp
3864
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
65+
--workdir=/app/scan \
66+
-v ./pr_branch/:/app/scan \
67+
-v ./artifact/${{ steps.extract_branch.outputs.branch }}:/artifact/${{ steps.extract_branch.outputs.branch }} \
68+
-v ./artifact/tmp:/tmp \
69+
-e APPCD_TOKEN=$APPCD_TOKEN \
70+
-e APPCD_URL=$APPCD_URL \
71+
--entrypoint=appcd \
72+
ghcr.io/appcd-dev/appcd-dist/appcd-cli:cli \
73+
generate --mode ci --log 2 --output=/artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts
74+
cd artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts
75+
unzip scan.zip && rm scan.zip && ls -latr
76+
- name: Upload logs
77+
uses: actions/upload-artifact@v2
78+
with:
79+
name: analyzer_logs_2
80+
path: artifact
4281
- name: Generate diff between Main and PR branch
4382
run: |
4483
mkdir -p pr_branch/deployment_files
45-
mv ./artifact/main/.appcd pr_branch/deployment_files/
84+
mv ./artifact/main/.appcd/charts/helm/scan_*/* pr_branch/deployment_files/
4685
cd pr_branch
4786
git config --local user.email "action@github.com"
4887
git config --local user.name "GitHub Action"
4988
git add deployment_files
5089
git commit -m "staging deployment files from main to compare them"
51-
rm -rf deploment_files/*
52-
rm -rf deployment_files/.appcd
90+
rm -rf deploment_files
5391
cd ..
54-
mv artifact/${{ steps.extract_branch.outputs.branch }}/.appcd pr_branch/deployment_files/
92+
mkdir -p pr_branch/deployment_files/
93+
cp -R artifact/${{ steps.extract_branch.outputs.branch }}/.appcd/charts/helm/scan_*/* pr_branch/deployment_files/
5594
cd pr_branch
56-
git diff --output=../diff.txt deployment_files/ | cat
95+
git add .
96+
git diff --staged --output=../diff.txt deployment_files/ | cat
5797
cat ../diff.txt
5898
- name: Comment PR with IaC Changes
5999
uses: actions/github-script@v6
@@ -62,7 +102,20 @@ jobs:
62102
script: |
63103
const fs = require('fs');
64104
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}\`\`\``;
105+
const body = `### AppCD Diff:\n\`\`\`${diff}\`\`\``;
106+
await github.rest.issues.createComment({
107+
issue_number: context.issue.number,
108+
owner: context.repo.owner,
109+
repo: context.repo.repo,
110+
body: body
111+
})
112+
- name: Trigger atlantis plan
113+
uses: actions/github-script@v6
114+
with:
115+
github-token: ${{secrets.GITHUB_TOKEN}}
116+
script: |
117+
const fs = require('fs');
118+
const body = `atlantis plan`;
66119
await github.rest.issues.createComment({
67120
issue_number: context.issue.number,
68121
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)