Skip to content

Commit

Permalink
fix: empty commit for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Forattini committed Jul 17, 2022
1 parent faab5c4 commit 5b37a0d
Show file tree
Hide file tree
Showing 12 changed files with 615 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/actions/config-scrapper/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/config-scrapper/index.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .github/actions/create-dockerfile/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 'Create Dockerfile'
description: ''

inputs:
writeSummary:
required: false
default: "false"
description: ""
preset:
required: false
default: "spa"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/create-dockerfile/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/actions/create-dockerfile/index.js.map

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,20 +265,9 @@ jobs:
id: hadolint
continue-on-error: true
with:
writeSummary: true
dockerfile: Dockerfile

- name: Docs | Lint result
run: |
echo "Hadolint: \`${{ steps.hadolint.outcome }}\`" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`txt \n $HADOLINT_RESULTS \n \`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-multi-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-multi-buildx

- name: Copy config
run: |
Expand Down
16 changes: 16 additions & 0 deletions src/actions/config-scrapper/src/deployment.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
const github = require("@actions/github");

module.exports = async (analysis) => {
let containerRegistry = core.getInput('containerRegistry', { required: true });

if (github.context.payload.deployment) {
analysis.environment = github.context.payload.deployment.environment
analysis.outputs.environment = analysis.environment
}

analysis.deployment.tags = [
`${imageFullname}:latest`,
`${imageFullname}:d-${this.output.run.date}`,
`${imageFullname}:r-${this.output.run.count}`,
`${imageFullname}:t-${this.output.run.startTimestamp}`,
`${imageFullname}:b-${this.output.git.branch.replace('/', '-')}`,
`${imageFullname}:c-${this.output.git.commit}`,
// `${imageFullName}:node-${matrix.node-version}`,
// `${imageFullName}:node-${matrix.node-version}-latest`,
// `${imageFullName}:node-${matrix.node-version}-d-${needs.Setup.outputs.Date}`,
// `${imageFullName}:node-${matrix.node-version}-b-${needs.Setup.outputs.Branch}`,
// `${imageFullName}:node-${matrix.node-version}-c-${needs.Setup.outputs.ShaHash}`,
]
}
12 changes: 12 additions & 0 deletions src/actions/config-scrapper/src/repository.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
const fs = require('fs')
const path = require('path')
const github = require("@actions/github")

module.exports = async (analysis) => {
const [ organization, name ] = github.context.payload.repository.full_name.split('/')

analysis.repository = {
name,
organization,
fullname: github.context.payload.repository.full_name,
}

analysis.outputs.repository = analysis.repository.name
analysis.outputs.organization = analysis.repository.organization

analysis.features = {
hasReleaseRC: fs.existsSync(path.join(analysis.root, '.releaserc.json')),
hasDockerfile: fs.existsSync(path.join(analysis.root, 'Dockerfile')),
Expand Down
4 changes: 4 additions & 0 deletions src/actions/create-dockerfile/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: 'Create Dockerfile'
description: ''

inputs:
writeSummary:
required: false
default: "false"
description: ""
preset:
required: false
default: "spa"
Expand Down
18 changes: 17 additions & 1 deletion src/actions/create-dockerfile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,23 @@ async function action() {
});

fs.writeFileSync(path.join(process.cwd(), "Dockerignore"), content);
core.warning(`content = ${content}`)

let writeSummary = core.getBooleanInput('writeSummary', { required: true });

if (writeSummary) {
await core.summary
.addHeading("📦 Deploy", 3)
.addEOL()
.addRaw(
[
"<details><summary>Dockerfile:</summary>\n\n```dockerfile \n",
content,
" \n\n ``` \n</details>",
].join(''),
true
)
.write();
}
}

try {
Expand Down
48 changes: 48 additions & 0 deletions src/actions/pack-docker-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'Static code analysis'
description: 'Greet someone'

inputs:
environment:
description: 'Environment target'
required: false
default: 'dev'
cached:
description: 'Inform the main repository language'
required: false
default: 'true'
platforms:
description: "Multi plataform container builds"
required: false
default: "linux/386,linux/amd64,linux/arm/v7,linux/arm/v8,linux/arm64,linux/ppc64le,linux/s390x"

runs:
using: "composite"

steps:
- name: Pipeline config scrapper
id: analysis
uses: filipeforattini/ff-iac-github-actions/.github/actions/config-scrapper@main

- name: Build and push
uses: docker/build-push-action@v2
if: inputs.cached == 'false'
with:
context: .
push: true
platforms: ${{ inputs.platforms }}
build-args: ${{steps.node_setup.outputs.docker_image_args}}
tags: ${{steps.node_setup.outputs.docker_image_tags}}, ${{steps.node_setup.outputs.docker_image_fullname}}:${{needs.Release.outputs.Version}}
labels: "organization: ${{github.repository_owner}}, repository: ${{github.repository}}, branch: ${{needs.Setup.outputs.Branch}}, commit: ${{needs.Setup.outputs.ShaHash}}, date: ${{needs.Setup.outputs.Date}}, timestamp: ${{needs.Setup.outputs.Timestamp}}"

- name: Build and push
uses: docker/build-push-action@v2
if: inputs.cached == 'true'
with:
context: .
push: true
platforms: ${{ inputs.platforms }}
build-args: ${{steps.node_setup.outputs.docker_image_args}}
tags: ${{steps.node_setup.outputs.docker_image_tags}}, ${{steps.node_setup.outputs.docker_image_fullname}}:${{needs.Release.outputs.Version}}
labels: "organization: ${{github.repository_owner}}, repository: ${{github.repository}}, branch: ${{needs.Setup.outputs.Branch}}, commit: ${{needs.Setup.outputs.ShaHash}}, date: ${{needs.Setup.outputs.Date}}, timestamp: ${{needs.Setup.outputs.Timestamp}}"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
509 changes: 509 additions & 0 deletions test/events/pr.json

Large diffs are not rendered by default.

0 comments on commit 5b37a0d

Please sign in to comment.