├── test ├── helmfile.yaml ├── repositories.yaml ├── charts │ └── skaffold │ │ ├── templates │ │ ├── job.yaml │ │ ├── serviceaccount.yaml │ │ ├── service.yaml │ │ ├── tests │ │ │ └── test-connection.yaml │ │ ├── hpa.yaml │ │ ├── ingress.yaml │ │ ├── NOTES.txt │ │ ├── deployment.yaml │ │ └── _helpers.tpl │ │ ├── .helmignore │ │ ├── Chart.yaml │ │ └── values.yaml ├── structure-test.yaml ├── skaffold.yaml └── Dockerfile ├── actions.skaffold.iml ├── LICENSE ├── .github └── workflows │ └── ci.yml ├── action.yml └── README.md /test/helmfile.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/repositories.yaml: -------------------------------------------------------------------------------- 1 | repositories: 2 | - name: bitnami 3 | url: https://charts.bitnami.com/bitnami 4 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/job.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: batch/v1 2 | kind: Job 3 | metadata: 4 | name: github-action-skaffold 5 | spec: 6 | template: 7 | spec: 8 | restartPolicy: Never 9 | containers: 10 | - name: version 11 | image: {{ .Values.image }} 12 | imagePullPolicy: IfNotPresent 13 | -------------------------------------------------------------------------------- /actions.skaffold.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/structure-test.yaml: -------------------------------------------------------------------------------- 1 | schemaVersion: 2.0.0 2 | 3 | metadataTest: 4 | workdir: /usr/local/bin 5 | entrypoint: 6 | - skaffold 7 | 8 | commandTests: 9 | - name: Test Skaffold version 10 | command: skaffold 11 | args: [version] 12 | exitCode: 0 13 | - name: Test Container Structure Test version 14 | command: container-structure-test 15 | args: [version] 16 | exitCode: 0 17 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccount.create -}} 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: {{ include "skaffold.serviceAccountName" . }} 6 | labels: 7 | {{- include "skaffold.labels" . | nindent 4 }} 8 | {{- with .Values.serviceAccount.annotations }} 9 | annotations: 10 | {{- toYaml . | nindent 4 }} 11 | {{- end }} 12 | {{- end }} 13 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "skaffold.fullname" . }} 5 | labels: 6 | {{- include "skaffold.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.service.type }} 9 | ports: 10 | - port: {{ .Values.service.port }} 11 | targetPort: http 12 | protocol: TCP 13 | name: http 14 | selector: 15 | {{- include "skaffold.selectorLabels" . | nindent 4 }} 16 | -------------------------------------------------------------------------------- /test/charts/skaffold/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/tests/test-connection.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: "{{ include "skaffold.fullname" . }}-test-connection" 5 | labels: 6 | {{- include "skaffold.labels" . | nindent 4 }} 7 | annotations: 8 | "helm.sh/hook": test-success 9 | spec: 10 | containers: 11 | - name: wget 12 | image: busybox 13 | command: ['wget'] 14 | args: ['{{ include "skaffold.fullname" . }}:{{ .Values.service.port }}'] 15 | restartPolicy: Never 16 | -------------------------------------------------------------------------------- /test/skaffold.yaml: -------------------------------------------------------------------------------- 1 | # nonk8s 2 | apiVersion: skaffold/v4beta2 3 | kind: Config 4 | metadata: 5 | name: github-action 6 | build: 7 | artifacts: 8 | - image: skaffold 9 | tagPolicy: 10 | sha256: { } 11 | local: 12 | push: false 13 | useBuildkit: true 14 | concurrency: 0 15 | deploy: 16 | helm: 17 | releases: 18 | - name: skaffold 19 | chartPath: charts/skaffold 20 | setValues: 21 | image: skaffold 22 | service.type: NodePort 23 | profiles: 24 | - name: ci 25 | activation: 26 | - env: CI=true 27 | build: 28 | local: 29 | push: false 30 | useBuildkit: true 31 | concurrency: 0 32 | test: 33 | - image: skaffold 34 | structureTests: 35 | - structure-test.yaml 36 | -------------------------------------------------------------------------------- /test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.16 2 | LABEL org.opencontainers.image.authors="Vlad Volkov " \ 3 | org.opencontainers.image.licenses="MIT" \ 4 | org.opencontainers.image.title="Skaffold" \ 5 | org.opencontainers.image.vendor="Hiberbee" 6 | WORKDIR /usr/local/bin 7 | ARG skaffold_version=1.38.0 8 | ARG container_structure_test_version=1.11.0 9 | ADD https://storage.googleapis.com/skaffold/releases/v${skaffold_version}/skaffold-linux-amd64 skaffold 10 | ADD https://storage.googleapis.com/container-structure-test/v${container_structure_test_version}/container-structure-test-linux-amd64 container-structure-test 11 | RUN chmod +x \ 12 | skaffold \ 13 | container-structure-test 14 | COPY skaffold.yaml Dockerfile structure-test.yaml ./ 15 | ENTRYPOINT ["skaffold"] 16 | CMD ["version"] 17 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/hpa.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.autoscaling.enabled }} 2 | apiVersion: autoscaling/v2beta1 3 | kind: HorizontalPodAutoscaler 4 | metadata: 5 | name: {{ include "skaffold.fullname" . }} 6 | labels: 7 | {{- include "skaffold.labels" . | nindent 4 }} 8 | spec: 9 | scaleTargetRef: 10 | apiVersion: apps/v1 11 | kind: Deployment 12 | name: {{ include "skaffold.fullname" . }} 13 | minReplicas: {{ .Values.autoscaling.minReplicas }} 14 | maxReplicas: {{ .Values.autoscaling.maxReplicas }} 15 | metrics: 16 | {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} 17 | - type: Resource 18 | resource: 19 | name: cpu 20 | targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} 21 | {{- end }} 22 | {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} 23 | - type: Resource 24 | resource: 25 | name: memory 26 | targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} 27 | {{- end }} 28 | {{- end }} 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Hiberbee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/ingress.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ingress.enabled -}} 2 | {{- $fullName := include "skaffold.fullname" . -}} 3 | {{- $svcPort := .Values.service.port -}} 4 | apiVersion: networking.k8s.io/v1 5 | kind: Ingress 6 | metadata: 7 | name: {{ $fullName }} 8 | labels: 9 | {{- include "skaffold.labels" . | nindent 4 }} 10 | {{- with .Values.ingress.annotations }} 11 | annotations: 12 | {{- toYaml . | nindent 4 }} 13 | {{- end }} 14 | spec: 15 | {{- if .Values.ingress.tls }} 16 | tls: 17 | {{- range .Values.ingress.tls }} 18 | - hosts: 19 | {{- range .hosts }} 20 | - {{ . | quote }} 21 | {{- end }} 22 | secretName: {{ .secretName }} 23 | {{- end }} 24 | {{- end }} 25 | rules: 26 | {{- range .Values.ingress.hosts }} 27 | - host: {{ .host | quote }} 28 | http: 29 | paths: 30 | {{- range .paths }} 31 | - path: {{ . }} 32 | backend: 33 | service: 34 | name: {{ $fullName }} 35 | port: 36 | number: {{ $svcPort }} 37 | {{- end }} 38 | {{- end }} 39 | {{- end }} 40 | -------------------------------------------------------------------------------- /test/charts/skaffold/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: skaffold 3 | description: A Helm chart for Kubernetes 4 | 5 | # A chart can be either an 'application' or a 'library' chart. 6 | # 7 | # Application charts are a collection of templates that can be packaged into versioned archives 8 | # to be deployed. 9 | # 10 | # Library charts provide useful utilities or functions for the chart developer. They're included as 11 | # a dependency of application charts to inject those utilities and functions into the rendering 12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. 13 | type: application 14 | 15 | # This is the chart version. This version number should be incremented each time you make changes 16 | # to the chart and its templates, including the app version. 17 | # Versions are expected to follow Semantic Versioning (https://semver.org/) 18 | version: 0.1.0 19 | 20 | # This is the version number of the application being deployed. This version number should be 21 | # incremented each time you make changes to the application. Versions are not expected to 22 | # follow Semantic Versioning. They should reflect the version the application is using. 23 | appVersion: 1.16.0 24 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | 1. Get the application URL by running these commands: 2 | {{- if .Values.ingress.enabled }} 3 | {{- range $host := .Values.ingress.hosts }} 4 | {{- range .paths }} 5 | http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} 6 | {{- end }} 7 | {{- end }} 8 | {{- else if contains "NodePort" .Values.service.type }} 9 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "skaffold.fullname" . }}) 10 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 11 | echo http://$NODE_IP:$NODE_PORT 12 | {{- else if contains "LoadBalancer" .Values.service.type }} 13 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. 14 | You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "skaffold.fullname" . }}' 15 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "skaffold.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") 16 | echo http://$SERVICE_IP:{{ .Values.service.port }} 17 | {{- else if contains "ClusterIP" .Values.service.type }} 18 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "skaffold.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 19 | echo "Visit http://127.0.0.1:8080 to use your application" 20 | kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 21 | {{- end }} 22 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: {{ include "skaffold.fullname" . }} 5 | labels: 6 | {{- include "skaffold.labels" . | nindent 4 }} 7 | spec: 8 | {{- if not .Values.autoscaling.enabled }} 9 | replicas: {{ .Values.replicaCount }} 10 | {{- end }} 11 | selector: 12 | matchLabels: {{ include "skaffold.selectorLabels" . | nindent 6 }} 13 | template: 14 | metadata: 15 | {{- with .Values.podAnnotations }} 16 | annotations: 17 | {{- toYaml . | nindent 8 }} 18 | {{- end }} 19 | labels: 20 | {{- include "skaffold.selectorLabels" . | nindent 8 }} 21 | spec: {{ with .Values.imagePullSecrets }} 22 | imagePullSecrets: {{ toYaml . | nindent 8 }} {{ end }} 23 | serviceAccountName: {{ include "skaffold.serviceAccountName" . }} 24 | securityContext: 25 | {{- toYaml .Values.podSecurityContext | nindent 8 }} 26 | containers: 27 | - name: {{ .Chart.Name }} 28 | securityContext: {{ toYaml .Values.securityContext | nindent 12 }} 29 | image: nginx:latest 30 | imagePullPolicy: IfNotPresent 31 | ports: 32 | - name: http 33 | containerPort: 80 34 | protocol: TCP 35 | livenessProbe: 36 | httpGet: 37 | path: / 38 | port: http 39 | readinessProbe: 40 | httpGet: 41 | path: / 42 | port: http 43 | resources: 44 | {{- toYaml .Values.resources | nindent 12 }} 45 | {{- with .Values.nodeSelector }} 46 | nodeSelector: 47 | {{- toYaml . | nindent 8 }} 48 | {{- end }} 49 | {{- with .Values.affinity }} 50 | affinity: 51 | {{- toYaml . | nindent 8 }} 52 | {{- end }} 53 | {{- with .Values.tolerations }} 54 | tolerations: 55 | {{- toYaml . | nindent 8 }} 56 | {{- end }} 57 | -------------------------------------------------------------------------------- /test/charts/skaffold/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "skaffold.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} 7 | {{- end }} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "skaffold.fullname" -}} 15 | {{- if .Values.fullnameOverride }} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} 17 | {{- else }} 18 | {{- $name := default .Chart.Name .Values.nameOverride }} 19 | {{- if contains $name .Release.Name }} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} 21 | {{- else }} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} 23 | {{- end }} 24 | {{- end }} 25 | {{- end }} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "skaffold.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} 32 | {{- end }} 33 | 34 | {{/* 35 | Common labels 36 | */}} 37 | {{- define "skaffold.labels" -}} 38 | helm.sh/chart: {{ include "skaffold.chart" . }} 39 | {{ include "skaffold.selectorLabels" . }} 40 | {{- if .Chart.AppVersion }} 41 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 42 | {{- end }} 43 | app.kubernetes.io/managed-by: {{ .Release.Service }} 44 | {{- end }} 45 | 46 | {{/* 47 | Selector labels 48 | */}} 49 | {{- define "skaffold.selectorLabels" -}} 50 | app.kubernetes.io/name: {{ include "skaffold.name" . }} 51 | app.kubernetes.io/instance: {{ .Release.Name }} 52 | {{- end }} 53 | 54 | {{/* 55 | Create the name of the service account to use 56 | */}} 57 | {{- define "skaffold.serviceAccountName" -}} 58 | {{- if .Values.serviceAccount.create }} 59 | {{- default (include "skaffold.fullname" .) .Values.serviceAccount.name }} 60 | {{- else }} 61 | {{- default "default" .Values.serviceAccount.name }} 62 | {{- end }} 63 | {{- end }} 64 | -------------------------------------------------------------------------------- /test/charts/skaffold/values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for skaffold. 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | replicaCount: 1 6 | 7 | image: nginx:latest 8 | imagePullPolicy: IfNotPresent 9 | # Overrides the image tag whose default is the chart appVersion. 10 | 11 | imagePullSecrets: [] 12 | nameOverride: "" 13 | fullnameOverride: "" 14 | 15 | serviceAccount: 16 | # Specifies whether a service account should be created 17 | create: true 18 | # Annotations to add to the service account 19 | annotations: {} 20 | # The name of the service account to use. 21 | # If not set and create is true, a name is generated using the fullname template 22 | name: "" 23 | 24 | podAnnotations: {} 25 | 26 | podSecurityContext: {} 27 | # fsGroup: 2000 28 | 29 | securityContext: {} 30 | # capabilities: 31 | # drop: 32 | # - ALL 33 | # readOnlyRootFilesystem: true 34 | # runAsNonRoot: true 35 | # runAsUser: 1000 36 | 37 | service: 38 | type: ClusterIP 39 | port: 80 40 | 41 | ingress: 42 | enabled: false 43 | annotations: {} 44 | # kubernetes.io/ingress.class: nginx 45 | # kubernetes.io/tls-acme: "true" 46 | hosts: 47 | - host: chart-example.local 48 | paths: [] 49 | tls: [] 50 | # - secretName: chart-example-tls 51 | # hosts: 52 | # - chart-example.local 53 | 54 | resources: {} 55 | # We usually recommend not to specify default resources and to leave this as a conscious 56 | # choice for the user. This also increases chances charts run on environments with little 57 | # resources, such as Minikube. If you do want to specify resources, uncomment the following 58 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'. 59 | # limits: 60 | # cpu: 100m 61 | # memory: 128Mi 62 | # requests: 63 | # cpu: 100m 64 | # memory: 128Mi 65 | 66 | autoscaling: 67 | enabled: false 68 | minReplicas: 1 69 | maxReplicas: 100 70 | targetCPUUtilizationPercentage: 80 71 | # targetMemoryUtilizationPercentage: 80 72 | 73 | nodeSelector: {} 74 | 75 | tolerations: [] 76 | 77 | affinity: {} 78 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Skaffold 2 | on: 3 | push: 4 | paths: 5 | - src/** 6 | - .github/workflows/ci.yml 7 | - action.yml 8 | jobs: 9 | build: 10 | name: Skaffold Build 11 | runs-on: ubuntu-22.04 12 | steps: 13 | - name: Checkout sources 14 | uses: actions/checkout@v3 15 | 16 | - name: Cache layers 17 | uses: actions/cache@v3 18 | with: 19 | path: "${{ github.workspace }}/.skaffold/cache" 20 | key: skaffold-${{ hashFiles('**/cache') }} 21 | restore-keys: | 22 | skaffold- 23 | 24 | - name: Run Skaffold pipeline as command 25 | uses: hiberbee/github-action-skaffold@latest 26 | id: build 27 | with: 28 | command: build 29 | working-directory: test 30 | skip-tests: false 31 | repository: ${{ secrets.SKAFFOLD_DEFAULT_REPO }} 32 | 33 | - name: Run Skaffold with output to JSON 34 | uses: hiberbee/github-action-skaffold@latest 35 | with: 36 | command: build 37 | file-output: tags.json 38 | repository: ${{ secrets.DOCKER_REPOSITORY }} 39 | working-directory: test 40 | 41 | - name: Read JSON file output 42 | run: cat tags.json 43 | working-directory: test 44 | 45 | - name: Read JSON step output 46 | run: echo '${{ steps.build.outputs.output }}' 47 | 48 | run: 49 | name: Skaffold Run 50 | runs-on: ubuntu-22.04 51 | steps: 52 | - name: Checkout sources 53 | uses: actions/checkout@v3 54 | 55 | - name: Setup Minikube 56 | uses: hiberbee/github-action-minikube@1.7.0 57 | with: 58 | addons: registry 59 | 60 | - name: Setup Helm 61 | uses: hiberbee/github-action-helm@1.13.0 62 | with: 63 | repository-config: test/repositories.yaml 64 | 65 | - name: Login to Docker Hub 66 | uses: docker/login-action@v2 67 | with: 68 | registry: ${{ secrets.DOCKER_REPOSITORY }} 69 | username: ${{ secrets.DOCKER_USERNAME }} 70 | password: ${{ secrets.DOCKER_PASSWORD }}\ 71 | 72 | - name: Cache layers 73 | uses: actions/cache@v3 74 | with: 75 | path: "{{ github.workspace }}/.skaffold/cache" 76 | key: skaffold-${{ hashFiles('**/cache') }} 77 | restore-keys: | 78 | skaffold- 79 | 80 | - name: Run Skaffold pipeline as action 81 | uses: hiberbee/github-action-skaffold@latest 82 | with: 83 | command: run 84 | cache: false 85 | insecure-registries: localhost:5000 86 | namespace: default 87 | repository: ${{ secrets.DOCKER_REPOSITORY }} 88 | verbosity: info 89 | working-directory: test 90 | 91 | - name: Run Skaffold with output to file 92 | uses: hiberbee/github-action-skaffold@latest 93 | with: 94 | command: build 95 | file-output: tags.json 96 | repository: ${{ secrets.DOCKER_REPOSITORY }} 97 | working-directory: test 98 | 99 | - name: Get Helm releases 100 | run: helm list 101 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Skaffold Github Action 2 | description: Setup Skaffold and all required dependencies 3 | author: hiberbee 4 | branding: 5 | icon: anchor 6 | color: blue 7 | inputs: 8 | skaffold-version: 9 | default: 2.3.1 10 | description: Set Skaffold version 11 | required: false 12 | kubectl-version: 13 | default: 1.26.2 14 | description: Set Kubectl version 15 | required: false 16 | container-structure-test-version: 17 | default: 1.15.0 18 | description: Set Container Structure Test version 19 | required: false 20 | command: 21 | default: 'diagnose' 22 | description: Skaffold command to execute. If no command provided, then skaffold will be installed and print version 23 | required: false 24 | concurrency: 25 | default: '' 26 | description: Number of concurrently running builds. If equals 0 - will run all builds in parallel 27 | required: false 28 | push: 29 | default: '' 30 | description: Push the built images to the specified image repository 31 | required: false 32 | image: 33 | default: '' 34 | description: Choose which artifacts to build. Artifacts with image names that contain the expression will be built only. Default is to build sources for all artifacts 35 | required: false 36 | images: 37 | default: '' 38 | description: Choose which image tags to test. 39 | required: false 40 | cache: 41 | default: '' 42 | description: Set to false to disable default caching of artifacts 43 | required: false 44 | repository: 45 | default: '' 46 | description: Default repository value (overrides global config) 47 | required: false 48 | insecure-registries: 49 | default: '' 50 | description: Target registries for built images which are not secure 51 | required: false 52 | filename: 53 | default: skaffold.yaml 54 | description: Path or URL to the Skaffold config file 55 | required: false 56 | kubeconfig: 57 | default: '' 58 | description: Path to the kubeconfig file to use for CLI requests 59 | required: false 60 | kube-context: 61 | default: '' 62 | description: Deploy to this Kubernetes context 63 | required: false 64 | namespace: 65 | default: "" 66 | description: Run deployments in the specified namespace 67 | required: false 68 | working-directory: 69 | default: '' 70 | description: Set current working directory similar to Github Actions run 71 | required: false 72 | profile: 73 | default: '' 74 | description: Activate profiles by name (prefixed with `-` to disable a profile) 75 | required: false 76 | skip-tests: 77 | default: '' 78 | description: Whether to skip the tests after building 79 | required: false 80 | verbosity: 81 | default: 'warning' 82 | description: Log level - one of [panic fatal error warning info debug trace] 83 | required: false 84 | interactive: 85 | default: '' 86 | description: Allow user prompts for more information 87 | required: false 88 | output: 89 | default: '' 90 | description: Format output with go-template 91 | required: false 92 | file-output: 93 | default: '' 94 | description: Filename to write build images to 95 | required: false 96 | tag: 97 | default: '' 98 | required: false 99 | description: The optional custom tag to use for images which overrides the current Tagger configuration 100 | outputs: 101 | output: 102 | description: Built image tags 103 | runs: 104 | using: node16 105 | main: src/index.js 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Skaffold Github Action 2 | 3 | > Code in [src](/src/) is autogenerated as build outcome from [@hiberbee/actions](https://github.com/hiberbee/actions) repository, which combines various DevOps Github Actions. If you would like to contribute, create PR in that repository. 4 | 5 |

6 | License 7 | GitHub Action Status 8 | GitHub Workflow Version 9 |

10 | 11 | Skaffold is a command line tool that facilitates continuous development for Kubernetes applications. You can iterate on your application source code locally then deploy to local or remote Kubernetes clusters. Skaffold handles the workflow for building, pushing and deploying your application. It also provides building blocks and describe customizations for a CI/CD pipeline. 12 | 13 | This action allows you to execute skaffold commands as Github Action. Repository is self-testable, so you can refer to [Skaffold manifest](test/skaffold.yaml), [Container Structure tests](test/structure-test.yaml) and [Github workflow](.github/workflows/ci.yml) 14 | 15 | ## Installed versions 16 | 17 | - skaffold 1.38.0 18 | - container-structure-test 1.11.0 19 | 20 | ## Inputs 21 | 22 | ### Required 23 | 24 | ### Optional 25 | 26 | | Name | Description | Default | 27 | |------------------------------------|------------------------------------------------------------------------------------------------|-------------------------| 28 | | `skaffold-version` | Set Skaffold version | 1.39.2 | 29 | | `container-structure-test-version` | Set Container Structure Test version | 1.11.0 | 30 | | `kubectl-version` | Set Kubernetes CLI version | 1.25.0 | 31 | | `working-directory` | Set current working directory similar to Github Actions run | ${{ github.workspace }} | 32 | | `filename` | Path or URL to the Skaffold config file | skaffold.yaml | 33 | | `command` | Default command for Skaffold to execute | diagnose | 34 | | `file-output` | Filename to write build images to | n/a | 35 | | `repository` | Default repository value (overrides global config) | n/a | 36 | | `insecure-registries` | Target registries for built images which are not secure | n/a | 37 | | `image` | Set Skaffold profile name | n/a | 38 | | `tag` | The optional custom tag to use for images which overrides the current Tagger configuration | n/a | 39 | | `push` | Push the built images to the specified image repository | n/a | 40 | | `concurrency` | Number of concurrently running builds. If equals 0 (default) - will run all builds in parallel | n/a | 41 | | `kube-context` | Deploy to this Kubernetes context | n/a | 42 | | `kubeconfig` | Path to the kubeconfig file to use for CLI requests | n/a | 43 | | `namespace` | Run deployments in the specified namespace | n/a | 44 | | `profile` | Activate profiles by name | n/a | 45 | | `output` | Format output with go-template | n/a | 46 | | `skip-tests` | Whether to skip the tests after building | true | 47 | | `cache` | Set to false to disable default caching of artifacts | true | 48 | | `cache-file` | Specify the location of the cache file | n/a | 49 | 50 | ## Outputs 51 | 52 | | Name | Description | Payload | 53 | |--------|------------------|---------------------------------------------------| 54 | | builds | Built image tags | ``` [{ "imageName": "string", tag: "string"}] ``` | 55 | 56 | ### Example 57 | 58 | #### Build Docker images 59 | 60 | ```yaml 61 | jobs: 62 | pipeline: 63 | name: Skaffold Docker build 64 | runs-on: ubuntu-20.04 65 | steps: 66 | - name: Build Docker images 67 | uses: hiberbee/github-action-skaffold@1.20.0 68 | with: 69 | command: build 70 | repository: ghcr.io/hiberbee/docker 71 | image: nodejs 72 | tag: ${{ github.sha }} 73 | ``` 74 | 75 | See more complex example with build, test & deployment simple Helm chart from Dockerfile to local K8S mini cluster. 76 | 77 | ```yaml 78 | name: Skaffold 79 | on: 80 | push: 81 | paths: 82 | - src/** 83 | - .github/workflows/ci.yml 84 | - action.yml 85 | jobs: 86 | pipeline: 87 | name: Skaffold Pipeline 88 | runs-on: ubuntu-20.04 89 | steps: 90 | - name: Checkout sources 91 | uses: actions/checkout@v3 92 | 93 | - name: Setup Minikube 94 | uses: hiberbee/github-action-minikube@1.5.0 95 | 96 | - name: Setup Helm 97 | uses: hiberbee/github-action-helm@1.3.0 98 | with: 99 | repository-config: test/repositories.yaml 100 | 101 | - name: Login to Docker Hub 102 | uses: docker/login-action@v1 103 | with: 104 | registry: ${{ secrets.DOCKER_REGISTRY }} 105 | username: ${{ secrets.DOCKER_USERNAME }} 106 | password: ${{ secrets.DOCKER_PASSWORD }} 107 | 108 | - name: Run Skaffold pipeline as action 109 | uses: hiberbee/github-action-skaffold@1.19.0 110 | with: 111 | command: run 112 | repository: ghcr.io/${{ github.repository }} 113 | 114 | - name: Get Helm releases 115 | run: helm list 116 | 117 | ``` 118 | 119 | ## CLI usage 120 | 121 | You can use that action just to set up Skaffold and then perform actions manually. Here is code sample: 122 | --------------------------------------------------------------------------------