|
| 1 | +--- |
| 2 | +draft: false |
| 3 | +date: 2024-10-25 |
| 4 | +authors: |
| 5 | + - jmgilman |
| 6 | +--- |
| 7 | + |
| 8 | +# What's New in Forge - 10-25-2024 |
| 9 | + |
| 10 | +Check out what's new in Forge this week. |
| 11 | + |
| 12 | +<!-- more --> |
| 13 | + |
| 14 | +## Releases |
| 15 | + |
| 16 | +The `publish` and `release` targets are no more! |
| 17 | +They have been replaced with an entirely new system that will enable adding more release automation going forward. |
| 18 | +Individual releases are now defined in a project's blueprint and Forge will automatically discover and execute them in the CI |
| 19 | +pipeline. |
| 20 | +Each release is run in parallel to maximize speed. |
| 21 | + |
| 22 | +The old targets will no longer automatically run in the CI. |
| 23 | +You will need to configure new releases in your project's blueprint file to continue publishing/releasing. |
| 24 | +The `publish` target has been replaced with the `docker` release type. |
| 25 | +The `release` target has been replaced with the `github` release type. |
| 26 | + |
| 27 | +For example, you can continue to use the `publish` target in your `Earthfile` by configuring a `docker` release type: |
| 28 | + |
| 29 | +```cue |
| 30 | +project: { |
| 31 | + name: "myproject" |
| 32 | + release: { |
| 33 | + docker: { |
| 34 | + on: { |
| 35 | + merge: {} |
| 36 | + tag: {} |
| 37 | + } |
| 38 | + config: { |
| 39 | + tag: _ @forge(name="GIT_COMMIT_HASH") |
| 40 | + } |
| 41 | + target: "publish" |
| 42 | + } |
| 43 | + } |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | +The above configuration will create a new docker release whenever a merge to the default branch occurs or when a new git tag is |
| 48 | +created. |
| 49 | +The published image will have its tag (`config.tag` above) automatically filled in with the git commit hash. |
| 50 | +Finally, Forge will call the `publish` target in your `Earthfile` to generate the container image. |
| 51 | + |
| 52 | +To learn more about releases, please refer to the [reference documentation](../../reference/releases/index.md). |
| 53 | + |
| 54 | +## Deployment Templates |
| 55 | + |
| 56 | +A new command has been introduced to the CLI: `forge deploy template`. |
| 57 | +This command can be used to generate the raw Kubernetes manifests (in YAML) that will be applied to the target Kubernetes cluster |
| 58 | +during automatic deployments. |
| 59 | +This is useful when troubleshooting why a deplyoment may be failing or acting in an unexpected way. |
| 60 | +All generated manifests will be printed to `stdout` and can be redirected to a local file for easier viewing. |
| 61 | + |
| 62 | +The below example shows what it looks like to generate the raw manifests for the Foundry API server: |
| 63 | + |
| 64 | +```text |
| 65 | +$ forge deploy template foundry/api |
| 66 | +--- |
| 67 | +# Instance: foundry-api |
| 68 | +--- |
| 69 | +apiVersion: v1 |
| 70 | +kind: Service |
| 71 | +metadata: |
| 72 | + labels: |
| 73 | + app.kubernetes.io/managed-by: timoni |
| 74 | + app.kubernetes.io/name: foundry-api |
| 75 | + app.kubernetes.io/version: 0.1.0 |
| 76 | + name: foundry-api |
| 77 | + namespace: default |
| 78 | +spec: |
| 79 | + ports: |
| 80 | + - name: http |
| 81 | + port: 80 |
| 82 | + protocol: TCP |
| 83 | + targetPort: http |
| 84 | + selector: |
| 85 | + app.kubernetes.io/name: foundry-api |
| 86 | + type: ClusterIP |
| 87 | +--- |
| 88 | +apiVersion: apps/v1 |
| 89 | +kind: Deployment |
| 90 | +metadata: |
| 91 | + labels: |
| 92 | + app.kubernetes.io/managed-by: timoni |
| 93 | + app.kubernetes.io/name: foundry-api |
| 94 | + app.kubernetes.io/version: 0.1.0 |
| 95 | + name: foundry-api |
| 96 | + namespace: default |
| 97 | +spec: |
| 98 | + replicas: 1 |
| 99 | + selector: |
| 100 | + matchLabels: |
| 101 | + app.kubernetes.io/name: foundry-api |
| 102 | + template: |
| 103 | + metadata: |
| 104 | + labels: |
| 105 | + app.kubernetes.io/name: foundry-api |
| 106 | + spec: |
| 107 | + containers: |
| 108 | + - image: 332405224602.dkr.ecr.eu-central-1.amazonaws.com/foundry-api:763fe7fd2bfdd39d630df9b5c5aa7e6588fc6eea |
| 109 | + imagePullPolicy: IfNotPresent |
| 110 | + livenessProbe: |
| 111 | + httpGet: |
| 112 | + path: / |
| 113 | + port: http |
| 114 | + initialDelaySeconds: 5 |
| 115 | + periodSeconds: 5 |
| 116 | + name: foundry-api |
| 117 | + ports: |
| 118 | + - containerPort: 8080 |
| 119 | + name: http |
| 120 | + protocol: TCP |
| 121 | + readinessProbe: |
| 122 | + httpGet: |
| 123 | + path: / |
| 124 | + port: http |
| 125 | + initialDelaySeconds: 5 |
| 126 | + periodSeconds: 5 |
| 127 | +``` |
| 128 | + |
| 129 | +For more information, please refer to the [deployments documentation](../../reference/deployments.md#templating). |
| 130 | + |
| 131 | +## What's Next |
| 132 | + |
| 133 | +Work is currenetly being done to improve automatic deployments for projects. |
| 134 | +Currently, Forge assumes a GitOps repository exists and will automatically generate and commit updated deployments to the configured |
| 135 | +repository. |
| 136 | +This makes setup complicated and introduces a mostly unecessary step in the deployment process. |
| 137 | + |
| 138 | +Instead, we are investigating having a GitOps operator (currently only Argo CD) point directly at a project's repository. |
| 139 | +Since a blueprint file is self-contained, it's possible to generate Kubernetes manifests using only the information inside of it. |
| 140 | +The first steps towards experimenting with this new solution was to create a |
| 141 | +[custom management plugin](https://github.com/input-output-hk/catalyst-forge/tree/master/tools/argocd) capable of ingesting a |
| 142 | +project and spitting out raw Kubernetes manifests. |
| 143 | +With this in place, it should be possible to point Argo CD directly at a project folder and have it generate the necessary manifests |
| 144 | +for deploying the project. |
| 145 | +As this process matures, more documentation will be released with the updated deployment process. |
| 146 | + |
| 147 | +That's it for this week, thanks for tuning in! |
0 commit comments