Skip to content

Commit

Permalink
Merge branch 'main' into update-pepr-webhook-example
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Rodriguez committed Nov 27, 2023
2 parents 64fc382 + 06c8e53 commit cce71f0
Show file tree
Hide file tree
Showing 28 changed files with 314 additions and 207 deletions.
30 changes: 15 additions & 15 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ zarf init [flags]

```
# Initializing without any optional components:
zarf init
# Initializing without any optional components:
$ zarf init
# Initializing w/ Zarfs internal git server:
zarf init --components=git-server
# Initializing w/ Zarfs internal git server:
$ zarf init --components=git-server
# Initializing w/ Zarfs internal git server and PLG stack:
zarf init --components=git-server,logging
# Initializing w/ Zarfs internal git server and PLG stack:
$ zarf init --components=git-server,logging
# Initializing w/ an internal registry but with a different nodeport:
zarf init --nodeport=30333
# Initializing w/ an internal registry but with a different nodeport:
$ zarf init --nodeport=30333
# Initializing w/ an external registry:
zarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME} --registry-url={URL}
# Initializing w/ an external registry:
$ zarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME} --registry-url={URL}
# Initializing w/ an external git server:
zarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}
# Initializing w/ an external git server:
$ zarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}
# Initializing w/ an external artifact server:
zarf init --artifact-push-password={PASSWORD} --artifact-push-username={USERNAME} --artifact-url={URL}
# Initializing w/ an external artifact server:
$ zarf init --artifact-push-password={PASSWORD} --artifact-push-username={USERNAME} --artifact-url={URL}
# NOTE: Not specifying a pull username/password will use the push user for pulling as well.
# NOTE: Not specifying a pull username/password will use the push user for pulling as well.
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ image registries and git repositories within the target environment
zarf package mirror-resources [ PACKAGE_SOURCE ] [flags]
```

## Examples

```
# Mirror resources to internal Zarf resources
$ zarf package mirror-resources <your-package.tar.zst> \
--registry-url 127.0.0.1:31999 \
--registry-push-username zarf-push \
--registry-push-password <generated-registry-push-password> \
--git-url http://zarf-gitea-http.zarf.svc.cluster.local:3000 \
--git-push-username zarf-git-user \
--git-push-password <generated-git-push-password>
# Mirror resources to external resources
$ zarf package mirror-resources <your-package.tar.zst> \
--registry-url registry.enterprise.corp \
--registry-push-username <registry-push-username> \
--registry-push-password <registry-push-password> \
--git-url https://git.enterprise.corp \
--git-push-username <git-push-username> \
--git-push-password <git-push-password>
```

## Options

```
Expand Down
8 changes: 4 additions & 4 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_package_publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf package publish { PACKAGE_SOURCE | SKELETON DIRECTORY } REPOSITORY [flags]

```
# Publish a package to a remote registry
zarf package publish my-package.tar oci://my-registry.com/my-namespace
# Publish a package to a remote registry
$ zarf package publish my-package.tar oci://my-registry.com/my-namespace
# Publish a skeleton package to a remote registry
zarf package publish ./path/to/dir oci://my-registry.com/my-namespace
# Publish a skeleton package to a remote registry
$ zarf package publish ./path/to/dir oci://my-registry.com/my-namespace
```

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_package_pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ zarf package pull PACKAGE_SOURCE [flags]
## Examples

```
zarf package pull oci://my-registry.com/my-namespace/my-package:0.0.1-arm64
$ zarf package pull oci://my-registry.com/my-namespace/my-package:0.0.1-arm64
```

## Options
Expand Down
20 changes: 10 additions & 10 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_tools_get-creds.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ zarf tools get-creds [flags]

```
# Print all Zarf credentials:
zarf tools get-creds
# Get specific Zarf credentials:
zarf tools get-creds registry
zarf tools get-creds registry-readonly
zarf tools get-creds git
zarf tools get-creds git-readonly
zarf tools get-creds artifact
zarf tools get-creds logging
# Print all Zarf credentials:
$ zarf tools get-creds
# Get specific Zarf credentials:
$ zarf tools get-creds registry
$ zarf tools get-creds registry-readonly
$ zarf tools get-creds git
$ zarf tools get-creds git-readonly
$ zarf tools get-creds artifact
$ zarf tools get-creds logging
```

Expand Down
26 changes: 25 additions & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools_monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,31 @@ zarf tools monitor [flags]
## Options

```
-h, --help help for monitor
-A, --all-namespaces Launch K9s in all namespaces
--as string Username to impersonate for the operation
--as-group stringArray Group to impersonate for the operation
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
-c, --command string Overrides the default resource to load when the application launches
--context string The name of the kubeconfig context to use
--crumbsless Turn K9s crumbs off
--headless Turn K9s header off
-h, --help help for monitor
--insecure-skip-tls-verify If true, the server's caCertFile will not be checked for validity
--kubeconfig string Path to the kubeconfig file to use for CLI requests
--logFile string Specify the log file
-l, --logLevel string Specify a log level (info, warn, debug, trace, error)
--logoless Turn K9s logo off
-n, --namespace string If present, the namespace scope for this CLI request
--readonly Sets readOnly mode by overriding readOnly configuration setting
-r, --refresh int Specify the default refresh rate as an integer (sec) (default 2)
--request-timeout string The length of time to wait before giving up on a single server request
--screen-dump-dir string Sets a path to a dir for a screen dumps
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--write Sets write mode by overriding the readOnly configuration setting
```

## SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf tools registry catalog REGISTRY [flags]

```
# list the repos internal to Zarf
$ zarf tools registry catalog
# List the repos internal to Zarf
$ zarf tools registry catalog
# list the repos for reg.example.com
$ zarf tools registry catalog reg.example.com
# List the repos for reg.example.com
$ zarf tools registry catalog reg.example.com
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ zarf tools registry delete IMAGE [flags]

```
# delete an image digest from an internal repo in Zarf
# Delete an image digest from an internal repo in Zarf
$ zarf tools registry delete 127.0.0.1:31999/stefanprodan/podinfo@sha256:57a654ace69ec02ba8973093b6a786faa15640575fbf0dbb603db55aca2ccec8
# delete an image digest from a repo hosted at reg.example.com
# Delete an image digest from a repo hosted at reg.example.com
$ zarf tools registry delete reg.example.com/stefanprodan/podinfo@sha256:57a654ace69ec02ba8973093b6a786faa15640575fbf0dbb603db55aca2ccec8
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ zarf tools registry digest IMAGE [flags]

```
# return an image digest for an internal repo in Zarf
# Return an image digest for an internal repo in Zarf
$ zarf tools registry digest 127.0.0.1:31999/stefanprodan/podinfo:6.4.0
# return an image digest from a repo hosted at reg.example.com
# Return an image digest from a repo hosted at reg.example.com
$ zarf tools registry digest reg.example.com/stefanprodan/podinfo:6.4.0
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf tools registry ls REPO [flags]

```
# list the tags for a repo internal to Zarf
$ zarf tools registry ls 127.0.0.1:31999/stefanprodan/podinfo
# List the tags for a repo internal to Zarf
$ zarf tools registry ls 127.0.0.1:31999/stefanprodan/podinfo
# list the tags for a repo hosted at reg.example.com
$ zarf tools registry ls reg.example.com/stefanprodan/podinfo
# List the tags for a repo hosted at reg.example.com
$ zarf tools registry ls reg.example.com/stefanprodan/podinfo
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf tools registry pull IMAGE TARBALL [flags]

```
# pull an image from an internal repo in Zarf to a local tarball
$ zarf tools registry pull 127.0.0.1:31999/stefanprodan/podinfo:6.4.0 image.tar
# Pull an image from an internal repo in Zarf to a local tarball
$ zarf tools registry pull 127.0.0.1:31999/stefanprodan/podinfo:6.4.0 image.tar
# pull an image from a repo hosted at reg.example.com to a local tarball
$ zarf tools registry pull reg.example.com/stefanprodan/podinfo:6.4.0 image.tar
# Pull an image from a repo hosted at reg.example.com to a local tarball
$ zarf tools registry pull reg.example.com/stefanprodan/podinfo:6.4.0 image.tar
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ zarf tools registry push PATH IMAGE [flags]

```
# push an image into an internal repo in Zarf
$ zarf tools registry push image.tar 127.0.0.1:31999/stefanprodan/podinfo:6.4.0
# Push an image into an internal repo in Zarf
$ zarf tools registry push image.tar 127.0.0.1:31999/stefanprodan/podinfo:6.4.0
# push an image into an repo hosted at reg.example.com
$ zarf tools registry push image.tar reg.example.com/stefanprodan/podinfo:6.4.0
# Push an image into an repo hosted at reg.example.com
$ zarf tools registry push image.tar reg.example.com/stefanprodan/podinfo:6.4.0
```

Expand Down
48 changes: 24 additions & 24 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_tools_update-creds.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ zarf tools update-creds [flags]

```
# Autogenerate all Zarf credentials at once:
zarf tools update-creds
# Autogenerate specific Zarf service credentials:
zarf tools update-creds registry
zarf tools update-creds git
zarf tools update-creds artifact
zarf tools update-creds agent
# Update all Zarf credentials w/external services at once:
zarf tools update-creds \
--registry-push-username={USERNAME} --registry-push-password={PASSWORD} \
--git-push-username={USERNAME} --git-push-password={PASSWORD} \
--artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Any credentials omitted from flags without a service key specified will be autogenerated - URLs will only change if specified.
# Config options can also be set with the 'init' section of a Zarf config file.
# Update specific Zarf credentials w/external services:
zarf tools update-creds registry --registry-push-username={USERNAME} --registry-push-password={PASSWORD}
zarf tools update-creds git --git-push-username={USERNAME} --git-push-password={PASSWORD}
zarf tools update-creds artifact --artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Not specifying a pull username/password will keep the previous pull username/password.
# Autogenerate all Zarf credentials at once:
$ zarf tools update-creds
# Autogenerate specific Zarf service credentials:
$ zarf tools update-creds registry
$ zarf tools update-creds git
$ zarf tools update-creds artifact
$ zarf tools update-creds agent
# Update all Zarf credentials w/external services at once:
$ zarf tools update-creds \
--registry-push-username={USERNAME} --registry-push-password={PASSWORD} \
--git-push-username={USERNAME} --git-push-password={PASSWORD} \
--artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Any credentials omitted from flags without a service key specified will be autogenerated - URLs will only change if specified.
# Config options can also be set with the 'init' section of a Zarf config file.
# Update specific Zarf credentials w/external services:
$ zarf tools update-creds registry --registry-push-username={USERNAME} --registry-push-password={PASSWORD}
$ zarf tools update-creds git --git-push-username={USERNAME} --git-push-password={PASSWORD}
$ zarf tools update-creds artifact --artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Not specifying a pull username/password will keep the previous pull username/password.
```

Expand Down
32 changes: 16 additions & 16 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_tools_wait-for.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ zarf tools wait-for { KIND | PROTOCOL } { NAME | SELECTOR | URI } { CONDITION |

```
# Wait for Kubernetes resources:
zarf tools wait-for pod my-pod-name ready -n default # wait for pod my-pod-name in namespace default to be ready
zarf tools wait-for p cool-pod-name ready -n cool # wait for pod (using p alias) cool-pod-name in namespace cool to be ready
zarf tools wait-for deployment podinfo available -n podinfo # wait for deployment podinfo in namespace podinfo to be available
zarf tools wait-for pod app=podinfo ready -n podinfo # wait for pod with label app=podinfo in namespace podinfo to be ready
zarf tools wait-for svc zarf-docker-registry exists -n zarf # wait for service zarf-docker-registry in namespace zarf to exist
zarf tools wait-for svc zarf-docker-registry -n zarf # same as above, except exists is the default condition
zarf tools wait-for crd addons.k3s.cattle.io # wait for crd addons.k3s.cattle.io to exist
zarf tools wait-for sts test-sts '{.status.availableReplicas}'=23 # wait for statefulset test-sts to have 23 available replicas
# Wait for network endpoints:
zarf tools wait-for http localhost:8080 200 # wait for a 200 response from http://localhost:8080
zarf tools wait-for tcp localhost:8080 # wait for a connection to be established on localhost:8080
zarf tools wait-for https 1.1.1.1 200 # wait for a 200 response from https://1.1.1.1
zarf tools wait-for http google.com # wait for any 2xx response from http://google.com
zarf tools wait-for http google.com success # wait for any 2xx response from http://google.com
# Wait for Kubernetes resources:
$ zarf tools wait-for pod my-pod-name ready -n default # wait for pod my-pod-name in namespace default to be ready
$ zarf tools wait-for p cool-pod-name ready -n cool # wait for pod (using p alias) cool-pod-name in namespace cool to be ready
$ zarf tools wait-for deployment podinfo available -n podinfo # wait for deployment podinfo in namespace podinfo to be available
$ zarf tools wait-for pod app=podinfo ready -n podinfo # wait for pod with label app=podinfo in namespace podinfo to be ready
$ zarf tools wait-for svc zarf-docker-registry exists -n zarf # wait for service zarf-docker-registry in namespace zarf to exist
$ zarf tools wait-for svc zarf-docker-registry -n zarf # same as above, except exists is the default condition
$ zarf tools wait-for crd addons.k3s.cattle.io # wait for crd addons.k3s.cattle.io to exist
$ zarf tools wait-for sts test-sts '{.status.availableReplicas}'=23 # wait for statefulset test-sts to have 23 available replicas
# Wait for network endpoints:
$ zarf tools wait-for http localhost:8080 200 # wait for a 200 response from http://localhost:8080
$ zarf tools wait-for tcp localhost:8080 # wait for a connection to be established on localhost:8080
$ zarf tools wait-for https 1.1.1.1 200 # wait for a 200 response from https://1.1.1.1
$ zarf tools wait-for http google.com # wait for any 2xx response from http://google.com
$ zarf tools wait-for http google.com success # wait for any 2xx response from http://google.com
```

Expand Down
6 changes: 6 additions & 0 deletions docs/3-create-a-zarf-package/7-component-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ Within each of the `action` lists (`before`, `after`, `onSuccess`, and `onFailur
- `setVariables` - set the standard output of the command to a list of variables that can be used in other actions or components (onDeploy only).
- `shell` - set a preferred shell for the command to run in for a particular operating system (default is `sh` for macOS/Linux and `powershell` for Windows).

:::info

By default, multi-line `cmd` blocks will fail if one of the lines errors out; this is analogous to setting `set -e` in a shell script, as documented in the [GNU bash docs](https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html).

:::

:::note

Any binaries you execute in your `cmd` actions must exist on the machine they are executed on. You can bring binaries with a Zarf Package as `files` with the `executable` key set, or take advantage of the `./zarf `&nbsp;transformation as described in [action transformations](#action-transformations).
Expand Down
10 changes: 10 additions & 0 deletions examples/component-actions/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,13 @@ components:
kind: configmap
name: simple-configmap
namespace: zarf

- name: on-deploy-immediate-failure
description: This component will fail on the first error instead of continuing execution
# the default for multi-line commands is set -e
actions:
onDeploy:
after:
- cmd: |
bad_cmd
echo "this text shouldn't be printed"
2 changes: 1 addition & 1 deletion packages/gitea/gitea-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gitea:
security:
INSTALL_LOCK: true
service:
DISABLE_REGISTRATION: "###ZARF_VAR_GIT_SERVER_DISABLE_REGISTRATION###"
DISABLE_REGISTRATION: ###ZARF_VAR_GIT_SERVER_DISABLE_REGISTRATION###
repository:
ENABLE_PUSH_CREATE_USER: true
FORCE_PRIVATE: true
Expand Down
4 changes: 2 additions & 2 deletions packages/gitea/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ variables:
- name: GIT_SERVER_REPLICA_COUNT
description: The number of git server replicas to deploy
default: "1"

- name: GIT_SERVER_DISABLE_REGISTRATION
description: Disables the ability to register new users
default: true
default: "true"

constants:
- name: GITEA_IMAGE
Expand Down
Loading

0 comments on commit cce71f0

Please sign in to comment.