Skip to content

Commit

Permalink
feat: Atualizar nome e versão do pacote para senhas 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliagranato committed Aug 26, 2024
1 parent c2076ea commit f9a457d
Show file tree
Hide file tree
Showing 11 changed files with 847 additions and 77 deletions.
159 changes: 88 additions & 71 deletions .github/workflows/chainguard.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,102 @@
name: Build e Distribuição de Pacotes com Melange e APKO

on:
push:
branches:
- 'main'

jobs:
build:
name: Build e Distribuição de Pacotes
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write
deploy:
runs-on: ubuntu-latest

steps:
- name: Fazer checkout do código
uses: actions/checkout@v3

- name: Configurar QEMU
uses: docker/setup-qemu-action@v3
# Passo 1: Checkout do código
- name: Checkout code
uses: actions/checkout@v3

- name: Instalar Cosign
uses: sigstore/cosign-installer@v3
# Passo 2: Configurar Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Configurar Docker Buildx
uses: docker/setup-buildx-action@v3
# Passo 3: Instalar Melange
- name: Install Melange
run: |
wget https://github.com/chainguard-dev/melange/releases/download/v0.11.2/melange_0.11.2_linux_386.tar.gz
tar -xzf melange_0.11.2_linux_386.tar.gz
sudo mv melange /usr/local/bin/
melange version
- name: Fazer login no Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Passo 4: Instalar APKO
- name: Install APKO
run: |
wget https://github.com/chainguard-dev/apko/releases/download/v0.14.7/apko_0.14.7_linux_386.tar.gz
tar -xzf apko_0.14.7_linux_386.tar.gz
sudo mv apko /usr/local/bin/
apko version
- name: Install Melange
run: |
wget https://github.com/chainguard-dev/melange/releases/download/v0.11.2/melange_0.11.2_linux_386.tar.gz
tar -xzf melange_0.11.2_linux_386.tar.gz
cd melange_0.11.2_linux_386
sudo mv melange /usr/local/bin/
sudo chmod +x /usr/local/bin/melange
melange version
# Passo 5: Gerar chaves com Melange
- name: Generate keys with Melange
run: |
cd chainguard
melange keygen
- name: Install APKO
run: |
wget https://github.com/chainguard-dev/apko/releases/download/v0.14.7/apko_0.14.7_linux_386.tar.gz
tar -xzf apko_0.14.7_linux_386.tar.gz
cd apko_0.14.7_linux_386
sudo mv apko /usr/local/bin/
sudo chmod +x /usr/local/bin/apko
apko version
# Passo 6: Construir pacotes com Melange
- name: Build packages with Melange
run: |
cd chainguard
melange build melange.yaml --runner docker --signing-key melange.rsa --arch amd64
- name: Gerar chaves com Melange
run: |
cd chainguard
melange keygen
# Passo 7: Construir imagem de container com APKO
- name: Build container image with APKO
run: |
cd chainguard
apko build apko.yaml senhas senhas.tar -k melange.rsa.pub --arch amd64
- name: Construir pacotes com Melange
run: |
cd chainguard
melange build melange.yaml --runner docker --signing-key melange.rsa --arch amd64
# Passo 8: Carregar a imagem Docker
- name: Load Docker image
run: |
docker load < senhas.tar
docker images
- name: Construir imagem de container com APKO
run: |
cd chainguard
apko build apko.yaml senhas:v1.0.0 giropops-senhas.tar -k melange.rsa.pub --arch amd64
# Passo 9: Fazer login no DockerHub
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Carregar a imagem Docker
run: |
docker load < chainguard/giropops-senhas.tar
# Passo 10: Gerar nome único para a tag
- name: Gerar nome único para a tag
id: generate-tag
run: |
SHORT_HASH=$(git log -1 --pretty=format:%h | cut -c1-5)
TIMESTAMP=$(date +%Y%m%d%H%M%S)
echo "tag=${SHORT_HASH}-${TIMESTAMP}" >> $GITHUB_ENV
echo "::set-output name=tag::${SHORT_HASH}-${TIMESTAMP}"
- name: Extrair metadados (tags, labels) para Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_USERNAME }}/giropops-senhas
# Passo 11: Fazer push da imagem Docker
- name: Fazer push da imagem Docker
run: |
docker tag senhas:latest-amd64 ${{ secrets.DOCKER_USERNAME }}/senhas:${{ steps.generate-tag.outputs.tag }}
docker push ${{ secrets.DOCKER_USERNAME }}/senhas:${{ steps.generate-tag.outputs.tag }}
- name: Gerar nome único para a tag
id: generate-tag
run: |
SHORT_HASH=$(git log -1 --pretty=format:%h | cut -c1-5)
TIMESTAMP=$(date +%Y%m%d%H%M%S)
echo "tag=${SHORT_HASH}-${TIMESTAMP}" >> $GITHUB_ENV
echo "::set-output name=tag::${SHORT_HASH}-${TIMESTAMP}"
# Passo 12: Scan de segurança com Trivy
- name: Aqua Security Trivy
uses: aquasecurity/trivy-action@0.24.0
with:
image-ref: nataliagranato/linuxtips-giropops-senhas:${{ steps.generate-tag.outputs.tag }}
format: 'sarif'
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
output: 'trivy-results.sarif'

- name: Fazer upload dos resultados do Trivy para a aba de Segurança do GitHub
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'trivy-results.sarif'

- name: Assinar imagem com uma chave
run: |
images=""
for tag in ${TAGS}; do
images+="${tag}@${DIGEST} "
done
cosign sign --yes --key env://COSIGN_PRIVATE_KEY $images
env:
TAGS: ${{ steps.meta.outputs.tags }}
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
DIGEST: ${{ steps.<load-images>.outputs.digest }}
51 changes: 51 additions & 0 deletions chainguard/melange.rsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEAwq9yCsE5qxsW9LooU7yQ80+APGT6fAz0c+qetKpAbUC42KPw
X2RToCT0vqNOcPdyEaUpF1jJ2DBaxHeLXT5qTqEUjO1tSsx9961lk+PXu4QOwuBj
mwmK9uS53/lgJ7OoPxofXq8qH7IMX/8Br+TvYRspGnZZ0kR+mLhl8J90eHSO43ze
9UbRdUqsTUg7Yyx33qxgkk5e2C+Qdyi0cInb2y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RZL50TxFPQS36CgqHuCVnS
EUjndfXDxNKb6oBWrHq8NC+w6I2hL/4/mNAKHs0rZtv4Xsg3SUcBiR9b9JQx41mu
SstbtQKCAQB6CTKQDQkm8e0NLSjqh9gCygHO71L7aGUe1YF9bAjaMgcYGr8MofOZ
bqv3z4vtXByiBJnDFnzbmvSwDtiptUiuS/34Or3flijgqC90iUUfhnUm4ARti+9a
P+qFyUf9kjSRfLFDl4RLJmAuX4M3o7xrVaDJbFUVOr2Xfbe/SF4DH6ZCqhzZuIhm
sh86lBqZya3bb+i3nVvxwjUixYRPE/IkZP4/Mksu751viYfRMOFDESytVDumQ6wT
p8cKzcIdlvsrz94hY/tGC8RjMJbfAOqeseVJKsVyleifY4QWTLOB9z8rvQPNcZXi
W+ktBF251IssKsPYPZT+A790IRstmzRNAoIBAQDRolwWiFBGSzcgaHrMGLgUvnO4
n+zZlyoC3dVqv9NJAlXCFVxABC46Arx41hr08DhmVtt2udZ5SpP3A4PNhhgeGFYZ
17rRUOyCUc2JArNKz1ZvVSMMDwH0o7kC1UptvNS2KfOr4VeyfslFKhjO5q1NQ3MH
EpjJ3rPPaw5eQ+qftYnq6qw+fkMf6b6apWsyOVFNYMQQfDgLaQvN36eT3Eesw5O6
HWXPMgACzXOwvWEHKQoYAu6/ecLTs0cElVlC1FwDI8J1eLWpIg1FuboU35CzOUVq
2NwCN3pKtT71WXvTQnKuftHZ3v1twkDjO+NZVfiQfIDRo8sK29HNmqaqwjFB
-----END RSA PRIVATE KEY-----
14 changes: 14 additions & 0 deletions chainguard/melange.rsa.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwq9yCsE5qxsW9LooU7yQ
80+APGT6fAz0c+qetKpAbUC42KPwX2RToCT0vqNOcPdyEaUpF1jJ2DBaxHeLXT5q
TqEUjO1tSsx9961lk+PXu4QOwuBjmwmK9uS53/lgJ7OoPxofXq8qH7IMX/8Br+Tv
YRspGnZZ0kR+mLhl8J90eHSO43ze9UbRdUqsTUg7Yyx33qxgkk5e2C+Qdyi0cInb
2y3xh5h6IwucMT6iq+dJNBRH8AgePQNoynC8WTy8Vfro1Rk754ouxPgzFhhHQUe1
zIYhSJNzT2PNAmBPOTiqf4o5Pra4K+W1uAdHWZp3LP6RxJP+cK04KZHkY3F/zidC
P3wCB3Y9DDgnC2zkuA2vOggN//JdD2p2pt89aM3UAQCsCi3LT9+amqzKYlMka10t
ZTiTR3DEUgEGlmwkFhycrDNp5t1EBcnVEEqQlxeGRqExkhZMBO+QuW9er27Tv2hN
w7nM0oAylMVsIcNjxDWuhljuJpw66pdADPTZbODL7NYoAJzv/KoG0uI4idvUz12B
JS0Rg00wXdV0oG5NgqLebV2uve/rZPq9CkkCyKExa2/xos5JFNrHCHiz8t2Yw2+1
YL7og0BvMRguVAqOIyDbK3CxDI/M/b5Fs15KVhq/drOw95D4XBD2Oy6oCIIplnYZ
Ji4xhgxJCQyEUQ25tN/IKncCAwEAAQ==
-----END PUBLIC KEY-----
4 changes: 2 additions & 2 deletions chainguard/melange.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: giropops-senhas
version: 0.1.0
name: senhas
version: 1.0.0
description: Um gerador de senhas.
copyright:
- license: Apache-2.0
Expand Down
33 changes: 29 additions & 4 deletions chainguard/packages/x86_64/APKINDEX.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,46 @@
"Origin": "giropops-senhas",
"Maintainer": "",
"URL": "",
"Checksum": "bdy/F1Io2uciWaAJTjxqtPWOtpw=",
"Checksum": "t2GV3n+Sk2R+MgZPTu0uD2AaWEs=",
"Dependencies": [
"python3",
"so:libc.musl-x86_64.so.1"
],
"Provides": null,
"InstallIf": null,
"Size": 6163053,
"InstalledSize": 17924625,
"Size": 6163069,
"InstalledSize": 17212997,
"ProviderPriority": 0,
"BuildTime": "1970-01-01T00:00:00Z",
"BuildDate": 0,
"RepoCommit": "",
"Replaces": null,
"DataHash": "35f42714a763c24a48dba3322c435dd4e749f1ab290b2c0f23e9c52edf1cb28a"
"DataHash": ""
},
{
"Name": "senhas",
"Version": "1.0.0-r0",
"Arch": "x86_64",
"Description": "Um gerador de senhas.",
"License": "Apache-2.0",
"Origin": "senhas",
"Maintainer": "",
"URL": "",
"Checksum": "TFIwM77H/NrvnJ4eTrAAHtZWRYk=",
"Dependencies": [
"python3",
"so:libc.musl-x86_64.so.1"
],
"Provides": null,
"InstallIf": null,
"Size": 6161572,
"InstalledSize": 17207975,
"ProviderPriority": 0,
"BuildTime": "1970-01-01T00:00:00Z",
"BuildDate": 0,
"RepoCommit": "",
"Replaces": null,
"DataHash": "7aad597f0fd83533abf80aca9fb836380577f347e957d61c507db1480e341fd3"
}
]
}
Binary file modified chainguard/packages/x86_64/APKINDEX.tar.gz
Binary file not shown.
Binary file modified chainguard/packages/x86_64/giropops-senhas-0.1.0-r0.apk
Binary file not shown.
Binary file added chainguard/packages/x86_64/senhas-1.0.0-r0.apk
Binary file not shown.
73 changes: 73 additions & 0 deletions chainguard/sbom-index.spdx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"SPDXID": "SPDXRef-DOCUMENT",
"name": "sbom-sha256:737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060",
"spdxVersion": "SPDX-2.3",
"creationInfo": {
"created": "2024-08-23T06:08:54Z",
"creators": [
"Tool: apko (v0.14.7)",
"Organization: Chainguard, Inc"
],
"licenseListVersion": "3.16"
},
"dataLicense": "CC0-1.0",
"documentNamespace": "https://spdx.org/spdxdocs/apko/",
"documentDescribes": [
"SPDXRef-Package-sha256-737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060"
],
"packages": [
{
"SPDXID": "SPDXRef-Package-sha256-737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060",
"name": "sha256:737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060",
"versionInfo": "sha256:737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060",
"filesAnalyzed": false,
"description": "Multi-arch image index",
"downloadLocation": "NOASSERTION",
"supplier": "Organization: Chainguard, Inc.",
"sourceInfo": "Generated at image build time by apko",
"primaryPackagePurpose": "CONTAINER",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060"
}
],
"externalRefs": [
{
"referenceCategory": "PACKAGE-MANAGER",
"referenceLocator": "pkg:oci/senhas@sha256%3A737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060?mediaType=application%2Fvnd.oci.image.index.v1%2Bjson",
"referenceType": "purl"
}
]
},
{
"SPDXID": "SPDXRef-Package-sha256-00e91458dc4e61f0272a6e14bbe87e62fa1a0d101dbbf7244c756d851d0ec091",
"name": "sha256:00e91458dc4e61f0272a6e14bbe87e62fa1a0d101dbbf7244c756d851d0ec091",
"versionInfo": "sha256:00e91458dc4e61f0272a6e14bbe87e62fa1a0d101dbbf7244c756d851d0ec091",
"filesAnalyzed": false,
"downloadLocation": "NOASSERTION",
"supplier": "Organization: Chainguard, Inc.",
"primaryPackagePurpose": "CONTAINER",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "00e91458dc4e61f0272a6e14bbe87e62fa1a0d101dbbf7244c756d851d0ec091"
}
],
"externalRefs": [
{
"referenceCategory": "PACKAGE-MANAGER",
"referenceLocator": "pkg:oci/senhas@sha256%3A00e91458dc4e61f0272a6e14bbe87e62fa1a0d101dbbf7244c756d851d0ec091?arch=amd64\u0026mediaType=application%2Fvnd.oci.image.manifest.v1%2Bjson\u0026os=linux",
"referenceType": "purl"
}
]
}
],
"relationships": [
{
"spdxElementId": "SPDXRef-Package-sha256-737c813461d72ae410a179a113793d0ef7d202d72ed168f83c77ab863406c060",
"relationshipType": "VARIANT_OF",
"relatedSpdxElement": "SPDXRef-Package-sha256-00e91458dc4e61f0272a6e14bbe87e62fa1a0d101dbbf7244c756d851d0ec091"
}
]
}
Loading

0 comments on commit f9a457d

Please sign in to comment.