feat: working within 2 major version

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
This commit is contained in:
Aleksei Igrychev
2024-04-24 14:03:13 +01:00
parent 43d2310151
commit 41f4b68701
17 changed files with 2639 additions and 1600 deletions

View File

@@ -38,6 +38,6 @@ jobs:
- name: Install - name: Install
uses: ./install uses: ./install
with: with:
version: v1.2.35 version: v2.1.0
- run: werf version - run: werf version

View File

@@ -21,7 +21,7 @@ converge:
fetch-depth: 0 fetch-depth: 0
- name: Install werf - name: Install werf
uses: werf/actions/install@v1.2 uses: werf/actions/install@v2
- name: Run script - name: Run script
run: | run: |
@@ -34,15 +34,7 @@ converge:
## Versioning ## Versioning
When using action, select the version corresponding to the required `MAJOR.MINOR` version of werf: When using action, select the version corresponding to the required `MAJOR` version of werf.
```yaml
# Setup actual werf version within 1.1 alpha channel.
- uses: werf/actions/install@v1.1
# Setup actual werf version within 1.2 alpha channel.
- uses: werf/actions/install@v1.2
```
By default, the action installs actual werf version within alpha channel (more details about channels, werf release cycle and compatibility promise [here](https://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)). By default, the action installs actual werf version within alpha channel (more details about channels, werf release cycle and compatibility promise [here](https://werf.io/installation.html#all-changes-in-werf-go-through-all-stability-channels)).
Using the `channel` input the user can switch the release channel. Using the `channel` input the user can switch the release channel.
@@ -50,7 +42,7 @@ Using the `channel` input the user can switch the release channel.
> This is recommended approach to be up-to-date and to use actual werf version without changing configurations. > This is recommended approach to be up-to-date and to use actual werf version without changing configurations.
```yaml ```yaml
- uses: werf/actions/install@v1.2 - uses: werf/actions/install@v2
with: with:
channel: alpha channel: alpha
``` ```
@@ -58,9 +50,9 @@ Using the `channel` input the user can switch the release channel.
Withal, it is not necessary to work within release channels, and the user might specify certain werf version with `version` input. Withal, it is not necessary to work within release channels, and the user might specify certain werf version with `version` input.
```yaml ```yaml
- uses: werf/actions/install@v1.2 - uses: werf/actions/install@v2
with: with:
version: v1.2.9 version: v2.1.0
``` ```
## FAQ ## FAQ
@@ -78,7 +70,7 @@ Make sure to use `fetch-depth: 0` setting in the checkout action, like follows:
By default, fetch-depth set to `1` which disables git history when checking out code. werf cache selection algorithm uses git history to determine whether some image bound to some commit could be used as a cache when building current commit (current commit should be descendant to the cache commit). By default, fetch-depth set to `1` which disables git history when checking out code. werf cache selection algorithm uses git history to determine whether some image bound to some commit could be used as a cache when building current commit (current commit should be descendant to the cache commit).
Setting `fetch-depth` to `0` enables full fetch of git history and it is a **recommended** approach. It is also possible to limit fetch history with some decent number of commits, which would enable images caching limited to that number of commits, but this would have a negative impact on cache reproducibility. Setting `fetch-depth` to `0` enables full fetch of git history, and it is a **recommended** approach. It is also possible to limit fetch history with some decent number of commits, which would enable images caching limited to that number of commits, but this would have a negative impact on cache reproducibility.
## License ## License

View File

@@ -38,7 +38,7 @@ build:
fetch-depth: 0 fetch-depth: 0
- name: Build - name: Build
uses: werf/actions/build@v1.2 uses: werf/actions/build@v2
with: with:
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }} kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
``` ```

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@ cleanup:
run: git fetch --prune --unshallow run: git fetch --prune --unshallow
- name: Cleanup - name: Cleanup
uses: werf/actions/cleanup@v1.2 uses: werf/actions/cleanup@v2
with: with:
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }} kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
env: env:

File diff suppressed because it is too large Load Diff

View File

@@ -41,7 +41,7 @@ converge:
fetch-depth: 0 fetch-depth: 0
- name: Converge - name: Converge
uses: werf/actions/converge@v1.2 uses: werf/actions/converge@v2
with: with:
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }} kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
env: production env: production

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@ dismiss:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Dismiss - name: Dismiss
uses: werf/actions/dismiss@v1.2 uses: werf/actions/dismiss@v2
with: with:
kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }} kube-config-base64-data: ${{ secrets.KUBE_CONFIG_BASE64_DATA }}
env: production env: production

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@ Using the `channel` input the user can switch the release channel.
> This is recommended approach to be up-to-date and to use actual werf version without changing configurations > This is recommended approach to be up-to-date and to use actual werf version without changing configurations
```yaml ```yaml
- uses: werf/actions/install@v1.2 - uses: werf/actions/install@v2
with: with:
channel: alpha channel: alpha
``` ```
@@ -17,9 +17,9 @@ Using the `channel` input the user can switch the release channel.
Withal, it is not necessary to work within release channels, and the user might specify certain werf version with `version` input. Withal, it is not necessary to work within release channels, and the user might specify certain werf version with `version` input.
```yaml ```yaml
- uses: werf/actions/install@v1.2 - uses: werf/actions/install@v2
with: with:
version: v1.2.9 version: v2.1.0
``` ```
## Inputs ## Inputs
@@ -46,7 +46,7 @@ werf:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install werf CLI - name: Install werf CLI
uses: werf/actions/install@v1.2 uses: werf/actions/install@v2
# For deploy and distributed locks. # For deploy and distributed locks.
- name: Create kube config - name: Create kube config

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@ run:
fetch-depth: 0 fetch-depth: 0
- name: Run - name: Run
uses: werf/actions/run@v1.2 uses: werf/actions/run@v2
with: with:
image: backend image: backend
args: rails server args: rails server

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,6 @@ import {String} from 'typescript-string-operations'
import {Manager} from './manager' import {Manager} from './manager'
import * as werf from './werf' import * as werf from './werf'
const minimalWerfVersion = 'v1.1.17'
export async function PrepareEnvironAndRunWerfCommand( export async function PrepareEnvironAndRunWerfCommand(
args: string[] args: string[]
): Promise<void> { ): Promise<void> {
@@ -67,27 +65,15 @@ export function ProcessGitHubContext(): void {
export function ValidateWerfVersion(version: string): void { export function ValidateWerfVersion(version: string): void {
const ver = semver.coerce(version) const ver = semver.coerce(version)
if (ver) { if (ver && ver.major === werf.MAJOR) {
if (ver.major !== werf.MAJOR || ver.minor !== werf.MINOR) { return
throw new Error(
String.Format(
'The arbitrary version ({0}) must be within the MAJOR.MINOR ({1})',
version.trim(),
werf.MAJOR_MINOR_GROUP
)
)
}
if (semver.gte(ver, minimalWerfVersion)) {
return
}
} }
throw new Error( throw new Error(
String.Format( String.Format(
'werf version {0} is not supported (expected version must be equal or greater than {1})', 'werf version {0} is not supported: the version must be semver and within the MAJOR ({1})',
version.trim(), version.trim(),
minimalWerfVersion werf.GROUP
) )
) )
} }

View File

@@ -125,7 +125,7 @@ export class Manager {
return this._constructReleaseUrl(version) return this._constructReleaseUrl(version)
} }
const url = `${WERF_TUF_SERVER_URL}/targets/channels/${werf.MAJOR_MINOR_GROUP}/${this.channel}` const url = `${WERF_TUF_SERVER_URL}/targets/channels/${werf.GROUP}/${this.channel}`
try { try {
const resp = await request const resp = await request
.get(url) .get(url)

View File

@@ -1,3 +1,2 @@
export const MAJOR_MINOR_GROUP = '1.2' export const GROUP = '2'
export const MAJOR = 1 export const MAJOR = 2
export const MINOR = 2