Skip to content

Commit

Permalink
ci: add test to release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Apr 24, 2024
1 parent 1dee650 commit d9beebd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,43 @@ jobs:
version: ${{ needs.process-inputs.outputs.NEXT_PATCH_PRE_WITHOUT_V }}
commit: true

test:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup_nix
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
cachixToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Log in to ghcr.io Container registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Azure
uses: azure/login@6b2456866fc08b011acb422a92a4aa20e2c4de32 # v2.1.0
with:
creds: ${{ secrets.CONTRAST_CI_INFRA_AZURE }}
- uses: nicknovitski/nix-develop@a2060d116a50b36dfab02280af558e73ab52427d # v1.1.0
- name: Create justfile.env
run: |
cat <<EOF > justfile.env
container_registry=${{ env.container_registry }}
azure_resource_group=${{ env.azure_resource_group }}
EOF
- name: Get credentials for CI cluster
run: |
just get-credentials
- name: E2E Test
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
nix shell .#contrast.e2e --command release.test -test.v --tag ${{ inputs.version }}
create-github-stuff:
name: Create backport label and milestone
if: ${{ inputs.kind == 'minor' }}
Expand Down
11 changes: 5 additions & 6 deletions e2e/release/release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestRelease(t *testing.T) {
require.NoError(err)

for _, r := range resources {
require.NoError(k.PatchNamespace(*namespace, r))
r.SetNamespace(*namespace)
}

require.NoError(k.Apply(ctx, resources...))
Expand All @@ -118,13 +118,12 @@ func TestRelease(t *testing.T) {
for _, info := range infos {
name := path.Join(path.Join(dir, "deployment"), info.Name())
yaml, err := os.ReadFile(name)
resources, err := kubeapi.UnmarshalUnstructuredK8SResource(yaml)
require.NoError(err)
resources, err := kubeapi.UnmarshalK8SResources(yaml)
require.NoError(err)

for _, r := range resources {
require.NoError(k.PatchNamespace(*namespace, r))
}
newYAML, err := kuberesource.EncodeUnstructured(resources)
resources = kuberesource.PatchNamespaces(resources, *namespace)
newYAML, err := kuberesource.EncodeResources(resources...)
require.NoError(err)
require.NoError(os.WriteFile(name, newYAML, 0o644))

Expand Down

0 comments on commit d9beebd

Please sign in to comment.