From a14bf4087c1cf62b6507b7a66d68b8870c0d4f6f Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 14:54:34 +0200 Subject: [PATCH 01/10] first commit --- .github/workflows/workflow.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..caa1103 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,26 @@ +name: main-worklfow +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + # Run all unit tests. + run-tests: + runs-on: ubuntu-latest + steps: + # Check out the pull request's source code. + - name: Check out source code + uses: actions/checkout@v3 + # Install Go. + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: "^1.14" + - name: Print Go version + run: go version + # Run unit tests. + - name: Run unit tests + run: go test -v ./... From e4cbd1bbd50fd660f4f5ce52f5b372c55cbf50c8 Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 14:56:49 +0200 Subject: [PATCH 02/10] rompi algo a proposito --- foobar/foobar.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foobar/foobar.go b/foobar/foobar.go index 1416c8e..7fbeb50 100644 --- a/foobar/foobar.go +++ b/foobar/foobar.go @@ -18,9 +18,9 @@ func Sequence(length int) ([]string, error) { for i := range seq { n := i + 1 switch { - case n%3 == 0 && n%5 == 0: + case n%3 == 0 && n%7 == 0: seq[i] = "foobar" - case n%5 == 0: + case n%7 == 0: seq[i] = "bar" case n%3 == 0: seq[i] = "foo" From a360b10cc8e9e59451f79670fb29c572f303b279 Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 14:58:24 +0200 Subject: [PATCH 03/10] rompi algo a proposito --- .github/workflows/workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index caa1103..5ccea27 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -3,9 +3,11 @@ on: push: branches: - master + - awesome-feature pull_request: branches: - master + - awesome-feature jobs: # Run all unit tests. run-tests: From 16542232478a6ded9663c41098d41c6c998008d8 Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 15:23:04 +0200 Subject: [PATCH 04/10] test --- foobar/foobar.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foobar/foobar.go b/foobar/foobar.go index 7fbeb50..1416c8e 100644 --- a/foobar/foobar.go +++ b/foobar/foobar.go @@ -18,9 +18,9 @@ func Sequence(length int) ([]string, error) { for i := range seq { n := i + 1 switch { - case n%3 == 0 && n%7 == 0: + case n%3 == 0 && n%5 == 0: seq[i] = "foobar" - case n%7 == 0: + case n%5 == 0: seq[i] = "bar" case n%3 == 0: seq[i] = "foo" From 61ec6718ea83a20e2e239430313513c5ff755643 Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 15:26:19 +0200 Subject: [PATCH 05/10] test3 --- .github/workflows/workflow.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5ccea27..6be2e69 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -8,6 +8,8 @@ on: branches: - master - awesome-feature +env: + IMAGE_REPOSITORY: placeholder-user/foobar jobs: # Run all unit tests. run-tests: @@ -26,3 +28,18 @@ jobs: # Run unit tests. - name: Run unit tests run: go test -v ./... + + # Build and release. + build-and-release: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v3 + - name: Build and push container image + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: ${{ env.IMAGE_REPOSITORY }} + tag_with_ref: true + tag_with_sha: true From 3d0b7eb1449592bbf8f682144465b86574c3cf17 Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 15:37:28 +0200 Subject: [PATCH 06/10] test4 --- .github/workflows/workflow.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 6be2e69..f11acba 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,40 +1,42 @@ -name: main-worklfow +name: main-workflow + +env: + IMAGE_REPOSITORY: TU_USUARIO_DOCKERHUB/foobar + on: push: branches: - master - awesome-feature + - awesome-feature-2 + pull_request: branches: - master - awesome-feature -env: - IMAGE_REPOSITORY: placeholder-user/foobar + - awesome-feature-2 + jobs: - # Run all unit tests. run-tests: runs-on: ubuntu-latest steps: - # Check out the pull request's source code. - name: Check out source code - uses: actions/checkout@v3 - # Install Go. + uses: actions/checkout@v2 + - name: Set up Go uses: actions/setup-go@v3 with: - go-version: "^1.14" - - name: Print Go version + go-version: "1.14" + + - name: Print go version run: go version - # Run unit tests. + - name: Run unit tests run: go test -v ./... - # Build and release. build-and-release: runs-on: ubuntu-latest steps: - - name: Check out source code - uses: actions/checkout@v3 - name: Build and push container image uses: docker/build-push-action@v1 with: @@ -42,4 +44,4 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} repository: ${{ env.IMAGE_REPOSITORY }} tag_with_ref: true - tag_with_sha: true + tag_with_sha: true \ No newline at end of file From 2f6c46d72aa34ae4adedcf098db6a494d2a4c1a0 Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 16:03:50 +0200 Subject: [PATCH 07/10] kubernetes --- .github/workflows/workflow.yml | 59 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index f11acba..f342470 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -1,47 +1,50 @@ -name: main-workflow - -env: - IMAGE_REPOSITORY: TU_USUARIO_DOCKERHUB/foobar - +name: main-worklfow on: + workflow_dispatch: push: branches: - master - - awesome-feature - - awesome-feature-2 - pull_request: branches: - master - - awesome-feature - - awesome-feature-2 - jobs: + # Run all unit tests. run-tests: runs-on: ubuntu-latest steps: + # Check out the pull request's source code. - name: Check out source code - uses: actions/checkout@v2 - + uses: actions/checkout@v3 + # Install Go. - name: Set up Go uses: actions/setup-go@v3 with: - go-version: "1.14" - - - name: Print go version + go-version: "^1.14" + - name: Print Go version run: go version - + # Run unit tests. - name: Run unit tests run: go test -v ./... - build-and-release: - runs-on: ubuntu-latest - steps: - - name: Build and push container image - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: ${{ env.IMAGE_REPOSITORY }} - tag_with_ref: true - tag_with_sha: true \ No newline at end of file +# Deploy to Kubernetes. +deploy: +runs-on: ubuntu-latest +if: github.ref == 'refs/heads/master' +needs: +- run-tests +- build-and-release +steps: +- uses: actions/checkout@v3 +- name: Configure kubectl +run: echo ${{ secrets.KUBECONFIG }} +| base64 -d > kubeconfig.yml +- name: Kustomize image +working-directory: ./manifests +run: kustomize edit set image \ +REPO:TAG=$IMAGE_REPOSITORY:sha-${GITHUB_SHA::7} +- name: Deploy to Kubernetes +run: kubectl --kubeconfig kubeconfig.yml \ +apply --kustomize manifests/ +- name: Validate deployment +run: kubectl --kubeconfig kubeconfig.yml \ +rollout status --timeout 120s deployment/foobar \ No newline at end of file From 851f53bf4764bb43cd06af36919a5ebfa5db0c6b Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 16:04:51 +0200 Subject: [PATCH 08/10] kubernetes2 --- .github/workflows/workflow.yml | 57 +++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index f342470..ba56c20 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -7,6 +7,8 @@ on: pull_request: branches: - master +env: + IMAGE_REPOSITORY: placeholder-user/foobar jobs: # Run all unit tests. run-tests: @@ -26,25 +28,36 @@ jobs: - name: Run unit tests run: go test -v ./... -# Deploy to Kubernetes. -deploy: -runs-on: ubuntu-latest -if: github.ref == 'refs/heads/master' -needs: -- run-tests -- build-and-release -steps: -- uses: actions/checkout@v3 -- name: Configure kubectl -run: echo ${{ secrets.KUBECONFIG }} -| base64 -d > kubeconfig.yml -- name: Kustomize image -working-directory: ./manifests -run: kustomize edit set image \ -REPO:TAG=$IMAGE_REPOSITORY:sha-${GITHUB_SHA::7} -- name: Deploy to Kubernetes -run: kubectl --kubeconfig kubeconfig.yml \ -apply --kustomize manifests/ -- name: Validate deployment -run: kubectl --kubeconfig kubeconfig.yml \ -rollout status --timeout 120s deployment/foobar \ No newline at end of file + # Build and release. + build-and-release: + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v3 + - name: Build and push container image + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: ${{ env.IMAGE_REPOSITORY }} + tag_with_ref: true + tag_with_sha: true + + # Deploy to Kubernetes. + deploy: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + needs: + - run-tests + - build-and-release + steps: + - uses: actions/checkout@v3 + - name: Configure kubectl + run: echo ${{ secrets.KUBECONFIG }} | base64 -d > kubeconfig.yml + - name: Kustomize image + working-directory: ./manifests + run: kustomize edit set image REPOSITORY:TAG=$IMAGE_REPOSITORY:sha-${GITHUB_SHA::7} + - name: Deploy to Kubernetes + run: kubectl --kubeconfig kubeconfig.yml apply --kustomize manifests/ + - name: Validate deployment + run: kubectl --kubeconfig kubeconfig.yml rollout status --timeout 120s deployment/foobar From 86b119ef503de684499b4f3b3e173d6e3861efd0 Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 16:06:00 +0200 Subject: [PATCH 09/10] kubernetes3 --- .github/workflows/workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ba56c20..9b0d3a1 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -4,9 +4,11 @@ on: push: branches: - master + - awesome-feature pull_request: branches: - master + - awesome-feature env: IMAGE_REPOSITORY: placeholder-user/foobar jobs: From 8ca9390ef533cdaff944ebc3f087d9454388592d Mon Sep 17 00:00:00 2001 From: Juan Paez Date: Thu, 1 Oct 2026 16:21:50 +0200 Subject: [PATCH 10/10] dockerhub bypass --- .github/workflows/workflow.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 9b0d3a1..dc8b880 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -10,7 +10,7 @@ on: - master - awesome-feature env: - IMAGE_REPOSITORY: placeholder-user/foobar + IMAGE_REPOSITORY: ghcr.io/paez1999/foobar jobs: # Run all unit tests. run-tests: @@ -33,14 +33,18 @@ jobs: # Build and release. build-and-release: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Check out source code uses: actions/checkout@v3 - name: Build and push container image uses: docker/build-push-action@v1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} repository: ${{ env.IMAGE_REPOSITORY }} tag_with_ref: true tag_with_sha: true