diff --git a/.github/workflows/build-int-on-push.yaml b/.github/workflows/build-int-on-push.yaml index 06daf08..4dcda52 100644 --- a/.github/workflows/build-int-on-push.yaml +++ b/.github/workflows/build-int-on-push.yaml @@ -8,12 +8,14 @@ on: paths-ignore: - 'doc/**' - '**.md' + jobs: build-image: uses: ./.github/workflows/reusable_lint_test_build_update.yaml with: - image_repo: "harbor.puzzle.ch/decidim/stlu/int/rails" - configmanagement: "gitlab.puzzle.ch/pitc_ruby/decidim-configmanagement" + image_repo: "https://harbor.puzzle.ch" + image_url: "harbor.puzzle.ch/decidim/stlu-int-rails" + configmanagement: "gitlab.puzzle.ch/pitc_ruby/decidim-configmanagement/" + configmanagement_branch: "feature/cloudscale" kustomization_path: "./deployments/pitc-stlu-decidim-int/kustomization.yaml" - - + secrets: inherit diff --git a/.github/workflows/reusable_build.yaml b/.github/workflows/reusable_build.yaml index 754e027..d140da9 100644 --- a/.github/workflows/reusable_build.yaml +++ b/.github/workflows/reusable_build.yaml @@ -16,7 +16,7 @@ on: images: description: 'Images arguments for docker/metadata-action' type: string - required: false + required: true flavor: description: 'Flavor argument for docker/metadata-action' type: string @@ -41,9 +41,11 @@ on: description: List of set tags value: ${{ jobs.build.outputs.tags }} labels: - description: + description: Label output value: ${{ jobs.build.outputs.labels }} - json: ${{ jobs.build.outputs.json }} + json: + description: JSON output + value: ${{ jobs.build.outputs.json }} jobs: build: diff --git a/.github/workflows/reusable_lint_test_build_update.yaml b/.github/workflows/reusable_lint_test_build_update.yaml index 3578f2b..6af2030 100644 --- a/.github/workflows/reusable_lint_test_build_update.yaml +++ b/.github/workflows/reusable_lint_test_build_update.yaml @@ -4,13 +4,21 @@ on: workflow_call: inputs: image_repo: - description: "Image repo to push image to" + description: "Image repo" + type: string + required: true + image_url: + description: "URL to push image to" type: string required: true configmanagement: description: "Configmanagement to write image tag to" type: string required: true + configmanagement_branch: + description: "Configmanagement branch to put the image tag into" + type: string + required: false kustomization_path: description: "Path to kustomization file" type: string @@ -24,14 +32,19 @@ jobs: build: needs: [lint, test] uses: ./.github/workflows/reusable_build.yaml - secrets: inherit + secrets: + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} with: repository_url: ${{ inputs.image_repo }} + images: ${{ inputs.image_url }} + flavor: latest=true update_tag: needs: [build] uses: ./.github/workflows/reusable_update_image.yaml secrets: inherit with: repository: ${{ inputs.configmanagement }} + repository_branch: ${{ inputs.configmanagement_branch }} file: ${{ inputs.kustomization_path }} - json: ${{ jobs.build.outputs.json }} + json: ${{ needs.build.outputs.json }} diff --git a/.github/workflows/reusable_tests.yaml b/.github/workflows/reusable_tests.yaml index bd6a02e..279d72c 100644 --- a/.github/workflows/reusable_tests.yaml +++ b/.github/workflows/reusable_tests.yaml @@ -12,7 +12,7 @@ jobs: postgres: image: 'postgis/postgis:14-3.3-alpine' env: - POSTGRESQL_PASSWORD: 'postgres' + POSTGRES_PASSWORD: 'postgres' ports: ['5432:5432'] options: >- --health-cmd pg_isready diff --git a/.github/workflows/reusable_update_image.yaml b/.github/workflows/reusable_update_image.yaml index a9684b2..d91bb6b 100644 --- a/.github/workflows/reusable_update_image.yaml +++ b/.github/workflows/reusable_update_image.yaml @@ -15,8 +15,14 @@ on: required: true repository_username: description: 'Username for repository login' + type: string required: false default: 'git' + repository_branch: + description: "The branch that should be edited" + type: string + required: false + default: main file: description: 'File in the repo to update' type: string @@ -46,9 +52,11 @@ jobs: REPO_URL: ${{ inputs.repository }} REPO_USER: ${{ inputs.repository_username }} REPO_TOKEN: ${{ secrets.REPOSITORY_TOKEN }} + REPO_BRANCH: ${{ inputs.repository_branch }} run: | git clone https://${REPO_USER}:${REPO_TOKEN}@${REPO_URL} ./management_repo cd ./management_repo + git switch ${REPO_BRANCH} git config user.name "Decidim Github Action Image updater" git config user.email "robot@puzzle.ch" git remote set-url origin "https://${REPO_USER}:${REPO_TOKEN}@${REPO_URL}" @@ -60,9 +68,10 @@ jobs: JSON: ${{ inputs.json }} with: cmd: | - TAG=$(echo "${JSON}" | yq -r '.tags[] | select(. | test("sha-"))') - echo $TAG - yq -i '.images.[] | select(.name == env(IMAGE_REF)) += {"newTag": env(TAG)}' "${FILE}" + ls -lha + # TAG=$(echo "${JSON}" | yq -r '.tags[] | select(. | test("sha-"))') + # echo $TAG + # yq -i '.images.[] | select(.name == env(IMAGE_REF)) += {"newTag": env(TAG)}' "${FILE}" - name: Commit & push back to repository env: IMAGE_REF: ${{ inputs.image_ref }}