From 4516bd461dc0fe553ca6457e677f4cfc62c5a03b Mon Sep 17 00:00:00 2001 From: Valeriy Svydenko Date: Mon, 29 Apr 2024 11:57:51 +0300 Subject: [PATCH 1/5] feat: use new community image Signed-off-by: Valeriy Svydenko --- .github/workflows/image-build.yaml | 81 ------------------------------ Dockerfile | 50 ------------------ README.md | 2 +- devfile.yaml | 2 +- requirements.txt | 5 -- 5 files changed, 2 insertions(+), 138 deletions(-) delete mode 100644 .github/workflows/image-build.yaml delete mode 100644 Dockerfile delete mode 100644 requirements.txt diff --git a/.github/workflows/image-build.yaml b/.github/workflows/image-build.yaml deleted file mode 100644 index 34a8c40..0000000 --- a/.github/workflows/image-build.yaml +++ /dev/null @@ -1,81 +0,0 @@ -name: Build and Push Ansible Creator EE Image - -on: - push: - branches: - - 'devspaces-[0-9].[0-9]+-rhel-8' - - devspaces-3-rhel-8 - - workflow_call: - secrets: - QUAY_USERNAME: - required: true - QUAY_PASSWORD: - required: true - -jobs: - build_ansible_creator_ee_image: - runs-on: ubuntu-22.04 - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - token: ${{secrets.VSVYDENK_GITHUB_TOKEN}} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: "Docker quay.io Login" - uses: docker/login-action@v2 - with: - registry: quay.io - username: ${{ secrets.QUAY_USERNAME }} - password: ${{ secrets.QUAY_PASSWORD }} - - - name: Check Commit Message - id: check_message - run: | - commit_message=$(git log --format=%B -n 1 ${{ github.sha }}) - prefix="chore(devfile):auto-update Ansible Creator EE image" - if [[ $commit_message == "$prefix"* ]]; then - echo "update_devfile=false" >> $GITHUB_OUTPUT - else - echo "update_devfile=true" >> $GITHUB_OUTPUT - fi - - - name: Build and push Docker image; Update image in devfile - if: steps.check_message.outputs.update_devfile == 'true' || github.actor == 'devstudio-release' - run: | - echo "Branch name: ${{ github.ref }}" - branch_name=${{ github.ref }} - branch_name=${branch_name#refs/heads/} - if [[ $branch_name == "devspaces-3-rhel-8" ]]; then - tag="latest" - else - tag=$(echo "$branch_name" | grep -o '[0-9]\+\.[0-9]\+') - fi - echo "Tag: $tag" - image_id=$(docker build -q -t "quay.io/devspaces/ansible-creator-ee:${tag}" .) - - short_sha=$(echo $image_id | cut -c8-12) - echo "Short SHA: $short_sha" - docker tag quay.io/devspaces/ansible-creator-ee:${tag} quay.io/devspaces/ansible-creator-ee:${tag}-${short_sha} - docker image push --all-tags quay.io/devspaces/ansible-creator-ee - - # rewrite devfile to update digest for ansible-creator-ee - docker pull quay.io/devspaces/ansible-creator-ee:${tag} - digest=$(docker inspect --format='{{index .RepoDigests 0}}' quay.io/devspaces/ansible-creator-ee:${tag}) - sed -r -i devfile.yaml -e "s|(image: .+devspaces/ansible-creator-ee.+)|image: ${digest}|g" - - - name: Set up Git - if: steps.check_message.outputs.update_devfile == 'true' || github.actor == 'devstudio-release' - run: | - git config --global user.email "vsvydenk@redhat.com" - git config --global user.name "Valerii Svydenko" - - - name: Commit and Push Changes - if: steps.check_message.outputs.update_devfile == 'true' || github.actor == 'devstudio-release' - run: | - git add . - git commit -m "chore(devfile):auto-update Ansible Creator EE image" - git push diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d295263..0000000 --- a/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -# quay.io/ansible/creator-ee:v0.21.0 -FROM quay.io/ansible/creator-ee@sha256:bf95ae745601a9d199eeb12807be24413fc2d6488016069816ee74342c2c255b - -ENV HOME=/home/runner - -# install additional modules required by ansible -COPY requirements.txt requirements.txt -RUN pip3 install -r requirements.txt - -## install golang for pre-commit -RUN microdnf install -y go - -## kubectl -RUN \ - microdnf install -y which && \ - microdnf clean all && \ - curl -LO https://dl.k8s.io/release/`curl -LS https://dl.k8s.io/release/stable.txt`/bin/linux/amd64/kubectl && \ - chmod +x ./kubectl && \ - mv ./kubectl /usr/local/bin && \ - kubectl version --client - -## helm -RUN \ - TEMP_DIR="$(mktemp -d)" && \ - cd "${TEMP_DIR}" && \ - HELM_VERSION="3.7.0" && \ - HELM_ARCH="linux-amd64" && \ - HELM_TGZ="helm-v${HELM_VERSION}-${HELM_ARCH}.tar.gz" && \ - HELM_TGZ_URL="https://get.helm.sh/${HELM_TGZ}" && \ - curl -sSLO "${HELM_TGZ_URL}" && \ - curl -sSLO "${HELM_TGZ_URL}.sha256sum" && \ - sha256sum -c "${HELM_TGZ}.sha256sum" 2>&1 | grep OK && \ - tar -zxvf "${HELM_TGZ}" && \ - mv "${HELM_ARCH}"/helm /usr/local/bin/helm && \ - cd - && \ - rm -rf "${TEMP_DIR}" - -# nodejs 18 + VSCODE_NODEJS_RUNTIME_DIR are required on ubi9 based images -# until we fix https://github.com/eclipse/che/issues/21778 -# When fixed, we won't need this Dockerfile anymore. -# c.f. https://github.com/che-incubator/che-code/pull/120 -RUN \ -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && \ -export NVM_DIR="$HOME/.nvm" && \ -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ -nvm install 18.18.0 -ENV VSCODE_NODEJS_RUNTIME_DIR="$HOME/.nvm/versions/node/v18.18.0/bin/" - -# Set permissions on /etc/passwd and /home to allow arbitrary users to write -RUN chgrp -R 0 /home && chmod -R g=u /etc/passwd /etc/group /home diff --git a/README.md b/README.md index 1a90892..5db5ef7 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ To get started with OpenShift Dev Spaces, refer to the [OpenShift Dev Spaces doc ## Base Image Of Devfile -Ultimately we intend to use the [ansible creator image](https://github.com/ansible/creator-ee) as the base image, however there are currently some [technical blockers](https://github.com/eclipse/che/issues/21778) to doing that. The `Dockerfile` in this repo is that of the image we are currently pulling down for reference. +[Community Ansible Dev Spaces Image](https://github.com/ansible/community-ansible-devspaces-image) is used as an image for Ansible development and it's defined in the `devfile.yaml`. ### GitHub OAuth2 diff --git a/devfile.yaml b/devfile.yaml index 444362b..e456d7b 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -4,7 +4,7 @@ metadata: components: - name: tooling-container container: - image: quay.io/devspaces/ansible-creator-ee@sha256:a1d053d24f0b80438568bd4e06437900f0afe0ae29fcfa749bbace5cfff8c2ca + image: ghcr.io/ansible/community-ansible-devspaces:latest@sha256:42af3f305fd9b19d1493099723c95cba3127b67a0d703b75a7cae4e362ddfea6 memoryRequest: 256M memoryLimit: 6Gi cpuRequest: 250m diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7ca710b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -kubernetes==26.1.0 -ansible-navigator==3.5.0 -pre-commit==3.6.0 -ansible-creator - From 72fa185a6f37214d9f90a1caa5c34fe08aab8e7b Mon Sep 17 00:00:00 2001 From: Valeriy Svydenko Date: Thu, 2 May 2024 16:53:25 +0300 Subject: [PATCH 2/5] fix image reference Signed-off-by: Valeriy Svydenko --- devfile.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devfile.yaml b/devfile.yaml index e456d7b..59ef8b5 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -4,7 +4,7 @@ metadata: components: - name: tooling-container container: - image: ghcr.io/ansible/community-ansible-devspaces:latest@sha256:42af3f305fd9b19d1493099723c95cba3127b67a0d703b75a7cae4e362ddfea6 + image: ghcr.io/ansible/ansible-workspace-env-reference@sha256:94cbf85b0b3f06ebaaf4d9c946c9bfaebec60f1df9f5fabfb607a2003ab50877 memoryRequest: 256M memoryLimit: 6Gi cpuRequest: 250m From 395393dc212f7a84a2a25483152fe57af6c853fc Mon Sep 17 00:00:00 2001 From: Valeriy Svydenko Date: Wed, 8 May 2024 19:58:19 +0300 Subject: [PATCH 3/5] update image digest Signed-off-by: Valeriy Svydenko --- devfile.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devfile.yaml b/devfile.yaml index 59ef8b5..fed9275 100644 --- a/devfile.yaml +++ b/devfile.yaml @@ -4,7 +4,7 @@ metadata: components: - name: tooling-container container: - image: ghcr.io/ansible/ansible-workspace-env-reference@sha256:94cbf85b0b3f06ebaaf4d9c946c9bfaebec60f1df9f5fabfb607a2003ab50877 + image: ghcr.io/ansible/ansible-workspace-env-reference@sha256:f02448b3b8423cfedf2773bb2dc8c21e2bf3a00c3df6e501916af2c5467a93f2 memoryRequest: 256M memoryLimit: 6Gi cpuRequest: 250m From 1bd839ddb398edceadbc59045e395a03c3286afd Mon Sep 17 00:00:00 2001 From: Valeriy Svydenko Date: Wed, 8 May 2024 20:30:20 +0300 Subject: [PATCH 4/5] fix .yamllint Signed-off-by: Valeriy Svydenko --- .yamllint | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.yamllint b/.yamllint index cf86578..8e8a42e 100644 --- a/.yamllint +++ b/.yamllint @@ -15,8 +15,12 @@ rules: commas: max-spaces-after: -1 level: error - comments: enable - comments-indentation: enable + comments: + min-spaces-from-content: 1 + comments-indentation: false + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true document-start: disable empty-lines: max: 3 From b393e3167cf80397bc3825d6eccfe19571f6e01a Mon Sep 17 00:00:00 2001 From: Valeriy Svydenko Date: Wed, 8 May 2024 20:34:36 +0300 Subject: [PATCH 5/5] fix linting Signed-off-by: Valeriy Svydenko --- playbooks/install_oc.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playbooks/install_oc.yml b/playbooks/install_oc.yml index 1cce46b..d94e8cf 100644 --- a/playbooks/install_oc.yml +++ b/playbooks/install_oc.yml @@ -18,13 +18,13 @@ ansible.builtin.file: path: "{{ molecule_user_home_dir }}/bin" state: directory - mode: 0770 + mode: a+x - name: Download oc binary from OCP downloads svc endpoint ansible.builtin.get_url: url: http://downloads.openshift-console.svc.cluster.local/amd64/linux/oc dest: "{{ molecule_user_home_dir }}/bin/oc" - mode: '0770' + mode: a+x - name: Add another bin dir to system-wide $PATH. ansible.builtin.lineinfile: