Skip to content

Commit

Permalink
fix: registry login token secret
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Forattini committed May 4, 2022
1 parent 50b126f commit bc1b365
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
41 changes: 13 additions & 28 deletions .github/workflows/service-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,18 @@ jobs:
with:
args: create secret generic --from-env-file=./manifests/k8s-secrets.env -n ${{steps.deploy_setup.outputs.deploy_repository}} svc-${{needs.Release-Node.outputs.Version}}

- name: Setup | Install QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Config | Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install | YTT
uses: vmware-tanzu/carvel-setup-action@v1
with:
Expand All @@ -471,6 +483,7 @@ jobs:
--data-value repository=${{steps.deploy_setup.outputs.deploy_repository}} \
--data-value tag=${{steps.deploy_setup.outputs.deploy_tag}} \
--data-value pipelineControl.datetime=${{steps.deploy_setup.outputs.run_started_at}} \
--data-value pipelineControl.dockerconfigjson="$(~/.docker/config.json)" \
> ./manifests/k8s-to-apply.yml
cat ./manifests/k8s-to-apply.yml
Expand All @@ -483,34 +496,6 @@ jobs:
with:
args: apply -f ./manifests/k8s-to-apply.yml

# - name: Setup | Install QEMU
# uses: docker/setup-qemu-action@v1
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1

# - name: Config | Login to GHCR
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Delete login token
# uses: actions-hub/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# args: delete secret registry-token -n ${{steps.node_setup.outputs.deploy_repository}} --ignore-not-found

# - name: Update login token
# uses: actions-hub/kubectl@master
# env:
# KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# args: create secret generic registry-token -n ${{steps.deploy_setup.outputs.deploy_repository}} --from-file=.dockerconfigjson=$HOME/.docker/config.json --type=kubernetes.io/dockerconfigjson

- name: K8s get current state
if: steps.deploy_setup.outputs.deploy_as_k8s == 'true'
uses: actions-hub/kubectl@master
Expand Down
3 changes: 2 additions & 1 deletion deploy/as-k8s/service.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tag: latest

#! features
features:
enableLinkerd: true
enableLinkerd: false

#! k8s resources
namespace:
Expand Down Expand Up @@ -44,3 +44,4 @@ ingress:
#! pipeline control
pipelineControl:
datetime: 'today'
dockertoken:
19 changes: 19 additions & 0 deletions deploy/as-k8s/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,28 @@ metadata:
#@ secretAnnotations.update(globalAnnotations)
annotations: #@ secretAnnotations
data:
data: #@ data.values
config-md5: #@ configMD5
config-sha256: #@ configSHA256

---
apiVersion: v1
kind: Secret
type: kubernetes.io/dockerconfigjson
metadata:
name: registry-token
#@ if data.values.namespace.enable:
namespace: #@ data.values.repository
#@ else:
namespace: default
#@ end

#@ secretAnnotations = {}
#@ secretAnnotations.update(globalAnnotations)
annotations: #@ secretAnnotations
data:
.dockerconfigjson: #@ data.values.pipelineControl.dockerconfigjson

---
#@ if data.values.deployment.enable:
apiVersion: apps/v1
Expand Down

0 comments on commit bc1b365

Please sign in to comment.